[racket] Access c based dll through ffi

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Feb 20 09:01:26 EST 2013

If you load this DLL via DrRacket, then you won't see output, because
stdout isn't connected to anything in particular in a GUI appplication.
That is, stdout at the C level is not redirected to the Racket current
output port.


If you use a command shell, run plain Racket, and then call the DLL,
then you should see the output. Or, if you use a shell to start
DrRacket as

 racket -l drracket

then output from the DLL will go to that shell window.

At Tue, 19 Feb 2013 13:30:58 +0100, heraklea at gmx.de wrote:
> Hello Danny,
> 
> here you are:
> 
> C++ Code:
> 
> [Code_Begin]
> #include <stdio.h>
> 
> extern "C"
> {
>   __declspec(dllexport) void DisplayHelloFromDLL()
>   {
>     printf ("Hello from DLL !\n");
> fflush(stdout);
>   }
> }
> 
> [Code_End]
> 
> (define-ffi-definer define-dreamlog (ffi-lib 
> "D:\\__w32\\DreamLogging\\x64\\Release\\DreamLogging.dll"))
> 
> 
> (define-dreamlog DisplayHelloFromDLL (_fun  -> (r : _void)))
> (DisplayHelloFromDLL)
> 
> Result: No output.
> 
> 
> Yours,
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.