[postgis] Compiling C functions for Postgis on Windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[postgis] Compiling C functions for Postgis on Windows

Nicolas Ribot-4
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.