30 Linking to DLLs on Windows🔗ℹ

Some Windows linking tools, such as MinGW-w64, accept a ".dll" for linking to generate an executable that refers to the ".dll". Other tools, such as Microsoft Visual Studio, need a ".lib" stub library to describe the ".dll" that will be used. The Racket distribution does not include ".lib" stub libraries, but various tools exist to generate a ".lib" file from a ".dll" and ".def" file that is included in a racket distribution.

To create a "x.lib" using Microsoft Visual Studio tools (to link with "x.dll"):

  • Locate the file "x.def" using the same base name x as in "x.dll".

  • Generate "x.lib" with this command:

      lib /def:x.def /out:x.lib /machine:mach

    Use a suitable platform description in place of mach, such as x64 for 64-bit Windows on x86_64.