Hi Philip,

On 2/12/2019 1:18 AM, Philip McGrath wrote:
I'm encountering an issue using `ffi-lib` to load a DLL on Windows. The problem appears to be specific to Racket, as I seem to be able to load the same DLL from Python.

Specifically, I'm trying to build platform-specific packages for libgit2. I can build the library and run its test suite successfully, but when I try to load the DLL with `ffi-lib`, using an absolute path to avoid any search issues, it fails with the message "%1 is not a valid Win32 application.; errid=193". The AppVeyor build log is here <https://ci.appveyor.com/project/philipmcgrath/native-libgit2-pkgs/build/job/urfo34x53oh0fr4l>, and this is the Racket script <https://github.com/LiberalArtist/native-libgit2-pkgs/blob/linker-errors/tmp-w64-test.rkt> that fails to load the DLL. As I mentioned, I can load the DLL successfully with this Python script <https://github.com/LiberalArtist/native-libgit2-pkgs/blob/linker-errors/py-w64-test-tmp.py>.

I'm not much of a Windows person, and I'm not sure what else to do to debug this.

If it isn't a simple 32-bit/64-bit mismatch, then it could be a lot of things. :-(

Unlike *nix, Windows supports several different kinds of DLLs.  If the wrong setting are used to compile or link, a Windows DLL can behave very oddly ... including working in one context (Python), but not in another (Racket).

You say you built the library from source?   I briefly looked at the source, but I'm not very familiar with cmake, and I don't see where the compile and link options are being defined.  Which compiler did you use and with what settings? [If they are defined in the project somewhere, you can just point me to the file(s).]

George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to