[geos-devel] Exceptions and CAPI

Olivier Bedel obedel at irisa.fr
Mon Nov 27 12:29:54 EST 2006


Hi all members of the list,

I try to handle exception with the CAPI. I use the  GEOSGeomFromWKT 
function and I want to avoid segmentation fault when a wrong wkt string 
is given as a parameter. Reading the comments in geos_c.h, I expected 
this function return a NULL pointer when an exception was raised, but 
strangely, it seems that he seg fault happens in the function call. So I 
get no return values and I can't handle exceptions.

Here is a simple example of what I want to do:
/****************************/
  GEOSGeometry *g;
  g = GEOSGeomFromWKT("POLYGON(0.0 0.0, 1.0 1.0, 2.0 2.0, 0.0 0.0))");
  if (g==NULL)
    fprintf(stderr,"g is not a valid geometry\n");
/****************************/

Do I miss something ?

Thanks in advance,
Olivier.




More information about the geos-devel mailing list