[racket] Access c based dll through ffi
At Wed, 13 Feb 2013 11:08:08 +0100, heraklea at gmx.de wrote:
> Hello Friends,
>
> I have make a little dll in visual studio :
> [CODE_BEGIN]
> #include <stdio.h>
>
> extern "C"
> {
> __declspec(dllexport) void DisplayHelloFromDLL()
> {
> printf ("Hello from DLL !\n");
> }
> }
> [CODE_END]
>
> After I try to access it through ffi like this:
> [CODE_BEGIN]
> #lang racket
>
> (require ffi/com
> ffi/unsafe
> ffi/unsafe/define
> ffi/winapi
> racket/string
> racket/format)
>
> (define-ffi-definer define-dreamlog (ffi-lib "DreamLogging"))
> [CODE_END]
>
>
> But I get an
> ffi-lib: couldn't open "DreamLogging.dll" (Unknown error; errno=193)
Error code 193 is "bad exe format". Are your DLL and Racket both 32-bit
or both 64-bit?
(The text of the error message says "Unknown error" because the
system-provided error text has a formatting command in it. I can make
Racket show the error text with the formatting command, which will be
ugly but more useful than showing only the error code.)