[postgis] Compiling C functions for Postgis on Windows

Nicolas Ribot nicol at ribot.com
Wed Dec 19 01:33:50 PST 2001


Yes, I know: it is very clever to do that on Windows, but it is just for
testing purpose.

I want to add some user-defined functions to postgis, mainly to deal
with geometries (adding some operators, maybe trying gpc on polygons).

I succeeded in compiling a very simple dll with a C function in it, and
declare it in Postgresql.
Now, I want to handle a function getting a geometry as parameter. I took
an example from the Postgis sources.
I can successfully compile my (very basic) source code, but the linking
fails:
I have an Unresolved External Symbol: _CurrentMemoryContext.
I'm liking with libpostgres.a, which should define this symbol (a looked
inside libpostgis.a and found a __imp_CurrentMemoryContext definition).

I saw in palloc.h, a header file contained in the utils folder of the
posgresql sources, the definition for CurrentMemoryContext with a
DLLIMPORT keyword behind:
extern DLLIMPORT MemoryContext CurrentMemoryContext;

I recompiled libpostgis.a without this DLLIMPORT macro, but it does not
solve the problem.

I'm running Postgresql/postgis on cygwin (windows NT).

Any help would be greatly appreciated.

Thanx.
Nicolas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20011219/4b229d5b/attachment.html>


More information about the postgis-users mailing list