代码之家  ›  专栏  ›  技术社区  ›  Graviton

在dll中找不到名为*的入口点

  •  1
  • Graviton  · 技术社区  · 14 年前

    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);
    

    我在VS2008中编译了它。它可以编译!到现在为止,一直都还不错。

    下一步我想从.NET调用C++ DLL,我做一个标准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);
    

    我认为我的C++ VcPROJ设置一定是错误的,因为它似乎没有导出定义。你知道怎么解决吗?

    3 回复  |  直到 14 年前
        1
  •  4
  •   user001    14 年前
    extern "C" __declspec(dllexport) void gpc_polygon_clip        (gpc_opset_operation,
                                  gpc_polygon     *subject_polygon,
                                  gpc_polygon     *clip_polygon,
                                  gpc_polygon     *result_polygon);
    

    在c++vc项目中试用以上方法。

        2
  •  2
  •   Jaka    10 年前

    gpc\U多边形\U片段未标记为导出。它应该使用\uu declspec(dllexport)。 看一看 here

        3
  •  1
  •   MSalters    14 年前

    有很多方法。可能最简单的方法是添加前缀 __declspec(dllexport) / __declspec(dllimport) 到声明(分别在编译或使用DLL时)