[gdal-dev] GDAL with MFC

Frank Warmerdam warmerdam at pobox.com
Mon Oct 26 13:53:32 EDT 2009


Yilmaz Arslanoglu wrote:
> Everything works perfect if this module is used in a non-MFC project
> (btw, projects are compiled with VS 2008) However, when the module is moved
> to an MFC-based project, sounding point values (x, y, and z) come as abnormal
> values, whereas no problem occurs with the values that come from the
> contour layer.

Yilmaz,

I did not see any obvious problem with your code or explanation of why
it might be failing.

> As another question, I do the following simple operation (again in MFC):
> 
>      OGRSpatialReference *poSRS = new OGRSpatialReference;
>      OGRSpatialReference::DestroySpatialReference(poSRS);
>
> and I get heap corruption error. Do we have another way to create a
> spatial reference system object for this purpose?

Use:

   OGRSpatialReference *poSRS = (OGRSpatialReference *)
         OSRNewSpatialReference(NULL);

You may need to include ogr_srs_api.h.  The OSR functions are
the C version of the ogr_spatialref.h C++ interface and can
be mixed with c++ with a bit of casting.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list