Creating a gpc-dll

Following is described how to compile gpc into a dll. This dll will be used by the GpcWrapper.

Changes necessary in gpc.c and gpc.h.

There are only a few changes needed. Some functions have to be exported. Therefore the attribute "__declspec(dllexport)" has to be add to some of the function definitions and their prototypes. The functions are:

For example for the function gpc_free_polygon you have to change

void gpc_free_polygon(gpc_polygon *p) { .... }
to
__declspec(dllexport) void gpc_free_polygon(gpc_polygon *p) { ... }
in gpc.c and in gpc.h you have to change the line
void gpc_free_polygon (gpc_polygon *polygon);
to
__declspec(dllexport) void gpc_free_polygon (gpc_polygon *polygon);

For Gpc Version 2.31 this has been already done in the files gpc.c and gpc.h contained in the GpcWrapper.zip file.

Compiling gpc.c and gpc.h to a dll.

For compiling you can use the compiler from the .Net Framework (cl.exe). Some instructions to install the .Net Framework you can find here: Installation of the .Net-Framework. Before you can call 'cl' some environment variables have to be set. This can be done by calling vcvars32.bat. This file is located e.g. in
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
Afterwards you can generate the dll simply by calling
cl /LD /MD gpc.c
In the File compile.cmd this has been already done. Maybe the Path to vcvars32.bat has to be changed.