This section describes a common case of mixed GNAT/Microsoft Visual Studio application development, where the main program is developed using MSVS and is linked with a DLL developed using GNAT. You should develop such a mixed application following the general guidelines outlined above; below is the cookbook-style sequence of steps to follow:
mylib.gpr
, producing the library libmylib.dll
):
$ gprbuild -p mylib.gpr
.def
file for the symbols you need to interface
with, either by hand or automatically with possibly some manual
adjustments (see Creating Definition File Automatically):
$ dlltool libmylib.dll -z libmylib.def --export-all-symbols
$ lib -machine:IX86 -def:libmylib.def -out:libmylib.lib
If you are using a 64-bit toolchain, the above becomes…
$ lib -machine:X64 -def:libmylib.def -out:libmylib.lib
main
:
$ cl /O2 /MD main.c libmylib.lib
.exe
.