[Gdal-dev] VC++ Wrapper

Frank Warmerdam warmerdam at pobox.com
Thu Oct 14 15:17:36 EDT 2004


Matthew Hanson wrote:
> Ok, I was looking through the OSSIM code and it looks like it also uses the
> C API instead of the C++ API.  
> So basically, you recommend developers to use the C API over C++.  In what
> situations would you recommend an application to use the native C++ API
> directly?

Matthew,

I would use the C++ API if implementing utilities being distributed as
part of GDAL.  I would also (potentially) use it if implementing an application
that I knew would also have GDAL built custom as part of it's build process.
Finally, the C++ API must be used if you want to extend GDAL with new drivers.

But if you are distributing something where you would potentially like people
to be able to substitute in a new GDAL DLL built with different options or bug
fixes, then targeting the C API saves alot of grief.

> Also, I'm trying to figure out how the code is put together and I see
> CPL_DLL in the function declarations for GDAL, and is OSSIM.  I'm not really
> sure what this does (though I do understand CPL is used to make GDAL
> portable to different platforms).
> Could you briefly comment on how CPL is used in GDAL and the CPL_DLL syntax
> in function and class declarations?

The gdal/port directory contains a bunch of stuff Daniel and I call the
Common Portability Library.  It is basically low level porting stuff, and
various convenience services (such as path parsing, string handling, etc).
It also includes the error handling code.  You will likely find you want
to wrap a bit of it, possibly including the CPL error handling, CPL
"ConfigOption" functions, and CPL "FileFinder" functions.

The CPL_DLL macro is used to mark all functions that we want exported from the
DLL under windows.  On unix it does nothing.

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