I have a C++ project with the following definition in the header file:
typedef enum /* Set operation type */
{
GPC_DIFF, /* Difference */
GPC_INT, /* Intersection */
GPC_XOR, /* Exclusive or */
GPC_UNION /* Union */
} gpc_op;
typedef struct /* Polygon vertex structure */
{
double x; /* Vertex x component */
double y; /* vertex y component */
} gpc_vertex;
typedef struct /* Vertex list structure */
{
int num_vertices; /* Number of vertices in list */
gpc_vertex *vertex; /* Vertex array pointer */
} gpc_vertex_list;
typedef struct /* Polygon set structure */
{
int num_contours; /* Number of contours in polygon */
int *hole; /* Hole / external contour flags */
gpc_vertex_list *contour; /* Contour array pointer */
} gpc_polygon;
void gpc_polygon_clip (gpc_op set_operation,
gpc_polygon *subject_polygon,
gpc_polygon *clip_polygon,
gpc_polygon *result_polygon);
And I compile it in VS 2008. It can compile! So far so good.
Next I want to call the C++ dll from .Net, and I do a standard PInvoke:
[DllImport("gpc.dll")]
private static extern void gpc_polygon_clip([In] GpcOperation set_operation,
[In] ref gpc_polygon subject_polygon,
[In] ref gpc_polygon clip_polygon,
[In, Out] ref gpc_polygon result_polygon);
But when I run the code, I get an "unable to find an entry point name * in DLL 'gpc.dll'".
I think my C++ vcproj setting must be wrong, because it seems that the definition is not exported. Any idea how to fix this?