[racket-dev] advice on linking against racket in windows

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Oct 8 13:39:06 EDT 2011

At Sat, 8 Oct 2011 10:28:58 -0700, John Clements wrote:
> I'm building cross-platform binaries, and one of my platforms is Windows.
> Moreover, I'm calling mzrt_sema primitives from my library, but those are the 
> only Racket functions I'm calling.

The main problem is that the mzrt_ functions are not currently exported
from the Racket DLL. We can change that for future versions, but
they're completely inaccessible from the current DLLs.

(On many platforms, all non-`static' functions are exported, so mzrt_
functions are exported anyway. But it doesn't work that way for

> 1) Ask the admins to install DrRacket, in the hope that raco ctool will 
> magically work on Windows the way it does under Mac OS X / Linux (this seems 
> unlikely to me).

That should work, as long as you set up the right environment variables,
which you would do with

  ...\Program Files...\Microsoft Visual Studio ...\VC\vcvarsall x86

or end with "x64" instead of x86" for a 64-bit build.

> 2) Find some racket DLL or .o file and the right scheme.h, and add them to my 
> Visual Studio 2010 project.

The right files are in the "include" and "lib/msvc" directories of your
Racket installation.

> 3) Extract the mzrt.c and mzrt.h source files, and add them directly to my 
> project.

That might work; I'm not sure.

Posted on the dev mailing list.