[Gdal-dev] VC++ Wrapper
Frank Warmerdam
warmerdam at pobox.com
Thu Oct 14 12:53:23 EDT 2004
Matthew Hanson wrote:
> Hi,
>
> I'm working on a managed wrapper for GDAL to create a .NET assembly.
>
> I just wanted to clarify a few things. The C++ API (in gdal_priv.h) looks
> like it's a C++ wrapper to the underlying C code. Is this true? If so, I
> think I'd rather interface with the C API then end up having a wrapper
> around a wrapper. Are there any benefits to using the C++ API?
Matt,
The C++ API is actually the "real" implementation. The C API is just
thin wrappers around it. Nevertheless, I encourage you to target the C API
because it is much less "fragile" than the C++ API. It becomes almost
impossible to substitute new versions of GDAL DLLs into an application that
calls the C++ API directly because of minor changes in method signatures
(like const correctness changes) or any change in the internal layout of
C++ objects (add new data members for instance).
So my experience has been that wrappers and applications written against
the C API are less tightly linked to a specific version of GDAL than C++
API callers.
> Also, there looks like there's some parts of GDAL (like the warp API) that
> are only in C++. In this case I'd have to use the C++ API. Are there any
> other parts of GDAL that only have a C++ API?
Alternatively, you can point out these issues to me, and I can look into
preparing C wrappers. My intent with the warp api would be that a C API should
exist for applications that want to instantiate and invoke a GDALWarpOperation
from an input GDALWarpOptions. The GDALWarpOptions is deliberately kept as a
simple C structure so it can be created and manipulated smoothly in C.
However, it has alot of callback functions which might be tricky to implement
in a .NET binding. I have not tried to implement the full warp API in Python
for instance.
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