Hello Sandro,
 
works perfect now, thank you! The solution for PostGIS2.0.x was to compile with
 
> cc -llwgeom -I/usr/include/pgsql/server -fpic -shared -o libtest.so test.c
 
and define the following function within test.c:
 
void lwgeom_init_allocators(void) {
    lwgeom_install_default_allocators();
}

/Peter
 

Gesendet: Montag, 11. November 2013 um 12:29 Uhr
Von: "Sandro Santilli" <[email protected]>
An: "PostGIS Users Discussion" <[email protected]>
Betreff: Re: [postgis-users] How to create user-defined C function using a 
postgis C function
On Mon, Nov 11, 2013 at 12:27:17PM +0100, Peter Tolkewitz wrote:
> Hello Sandro,
>  
> thank you for your answer. For testing I wrote another main() class:
>  
> --- start main.c ---
>
> int main() {
>   test(0,0);
>   return 0;
> }
> --- end main.c ---
>  
> and compiled
>  
> > cc -I/usr/include/pgsql/server -fpic -shared -o libtest.so test.c
> > cc -llwgeom -ltest main.c -o main -L. -L/usr/lib64
>  
> In /usr/lib64 the liblwgeom.so is located (a liblwgeom.a I cannot find).
>  
>
> Now the original error is resolved, but now I get
>  
> /usr/lib64/liblwgeom.so: undefined reference to `lwgeom_init_allocators'
>  
> Any ideas how to resolve this?

As of PostGIS 2.0.x you need to provide that function in your own library,
if you switch to PostGIS 2.1.x you'll have a different requirement, due to:

- #2089, liblwgeom: lwgeom_set_handlers replaces lwgeom_init_allocators.

--strk;
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Reply via email to