[racket] Windows FFI Problem

From: Gustavo Massaccesi (gustavo at oma.org.ar)
Date: Fri Jan 16 17:40:13 EST 2015

The System32 folder is for 64 bits dll's. You must put the 32 bits
dll's in the SysWOW64. (Lucky they drop the support for the 16 bits
applications.)

I'm not sure were you should put 32 bits dll's that have to be called
by 64 bit programs.
It's a mess, and when you have to install something manually it's very
confusing. IIRC the problem was that all the programs were using the
System32 folder as default, so it was easier to make this mess than
change all the other programs. Backwards compatibility and automatic
upgrades are a nightmare.

http://www.samlogic.net/articles/32-64-bit-windows-folder-x86-syswow64.htm

Some related information:

http://blogs.msdn.com/b/oldnewthing/archive/2008/12/22/9244582.aspx

http://blogs.msdn.com/b/oldnewthing/archive/2011/06/20/10176772.aspx

Gustavo

On Fri, Jan 16, 2015 at 1:01 PM, Michael Wilber <gcr at sneakygcr.net> wrote:
> Does this work if you place the .DLL in the same directory as the Racket
> executable?
>
> What if it's placed in your System32 folder?
>
> If you need to put the library in a nonstandard path (I think putting
> the .dll in the same folder as the .rkt script is nonstandard), try
> registering the DLL. See
> http://stackoverflow.com/questions/4897685/how-do-i-register-a-dll-file-on-windows-7-64-bit
>
> Lehi Toskin <lehi at tosk.in> writes:
>> On Thu, 15 Jan 2015 18:55:41 -0700, Matthew Flatt wrote:
>>
>>> At Thu, 15 Jan 2015 22:10:35 +0000 (UTC), Lehi Toskin wrote:
>>>> I am attempting to use this C library I've written with the Racket FFI,
>>>> but (ffi-lib "mylib") reports "The specified module could not be
>>>> found.;
>>>> errno=126". This only happens on Windows. On Linux the library gets
>>>> loaded properly and I can use it fine. What could be the problem?
>>>
>>> Can you say more about where "mylib.dll" is located in your Windows
>>> installation --- and maybe also where it's located on Linux, for
>>> comparison?
>>>
>>
>> I actually have the library in the same directory as the script for both
>> platforms. I've tried "mylib", "mylib.dll" and even permutations of "path/
>> to/lib/directory/mylib".
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.