【问题标题】:How to call a function of postgis-1.5.dll in c code如何在c代码中调用postgis-1.5.dll的函数
【发布时间】:2012-12-04 03:37:20
【问题描述】:

我正在 c 中创建一个使用 Postgis Point 的 Postgresql 扩展。当我在加载后尝试调用 postgis-1.5.dll 的函数时,它失败并且我没有收到错误消息 这是我的一小部分代码:

    Point *pt =(Point*) palloc(sizeof(Point));
    bool test;
    HINSTANCE DLLHandle;
typedef bool(*ST_empty)(Point*);

ST_emptyPtr ST_empty;

    pt->x = 0.2;
    pt->y = 0.9;
DLLHandle = LoadLibrary(L"postgis-1.5.dll");
ST_empty = (ST_emptyPtr)GetProcAddress(DLLHandle,"LWGEOM_isempty"); 
if (DLLHandle != NULL){
   if(!ST_empty)
     elog(ERROR,"null ehhhh");

   test = ST_empty(p);
       elog(ERROR,"not empty");
    }

谁能帮帮我?

【问题讨论】:

    标签: postgresql dll postgis postgresql-9.1 postgresql-9.0


    【解决方案1】:

    查看源代码可能会有所帮助: lwgeom_is_empty from PostGIS Trunk

    你确定它失败了吗?上面的代码不测试函数调用的返回值。以下是做什么的?

    if (!ST_empty(p))
      elog(ERROR,"not empty");
    

    布赖恩

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-18
      相关资源
      最近更新 更多