[racket] Windows FFI Problem

From: Lehi Toskin (lehi at tosk.in)
Date: Sun Jan 18 01:51:20 EST 2015

On Fri, 16 Jan 2015 11:40:38 -0800, Ben Goetter wrote:

> On 1/16/2015 11:00 AM, Lehi Toskin wrote:
>> Good news is it's giving me a new error! Yay! "%1 is not a valid Win32
>> application.; errno=193"
> 
> This is /the/ classical 32-versus-64-bit mismatch error.  Most likely,
> once of the DLLs that your DLL in turn depends on is loading in the
> wrong flavor.  Bitness is the most likely suspect, but you could also
> conceivably have a version compiled for a different target architecture.
> 
> To decipher this and future error codes, look them up in winerror.h in
> your Windows SDK.  Then go grepping through msdn.microsoft.com with the
> name of the constant.  This one is ERROR_BAD_EXE_FORMAT.
> 
> You probably should take Racket out of the loop here.  Write a four-line
> C program that explicitly tries to load your DLL. Something like
> 
> #include <windows.h>
> HANDLE h = LoadLibraryA("mydll.dll");
> if (NULL == h) printf("ERROR %lu\n", GetLastError());
> else { FreeLibrary(h); printf("Great success\n"); }
> 
> Compile that fragment in the same bitness of your Racket installation on
> Windows, and use it to ensure that your DLL itself can resolve all its
> dependencies.  Once your DLL can pass this test, feed it to Racket.
> 
> Ben
> 
> ____________________
>   Racket Users list: http://lists.racket-lang.org/users

I have used that little bit of checking code on the libraries mylib 
depends on and they all load, but if I compile mylib against them it 
fails that check. As far as I can tell, everything under the sun is 64-
bit. I am halfway tempted to say that my Windows VM is haunted and wash 
my hands of it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20150118/30918060/attachment.sig>

Posted on the users mailing list.