[Gdal-dev] Exception thrown in GDALOpen() function

Frank Warmerdam warmerdam at pobox.com
Sun Aug 3 11:23:01 EDT 2003


Roger James wrote:

> The other issue with mixed libraries occurs when you are using the dll
> version of gdal or are linking the static library version into a dll.
> You end up with memory being allocated and freed from different heaps.
> This is an issue that both Ben and I have come across, and is why we now
> run with modified gdal makefiles that build differently named debug and
> non debug versions.
> 
> If you are having to resort to using ignoredefaultlibs then it is likely
> that you will eventually run into problems.

Roger,

OK, I understand that under some circumstances different DLLs each have their
own heap.  I have worked under these conditions when using the regular LIBC
instead of the runtime C library with MSVC, and with some care it need not
be impossible.  In fact, it was for this reason I introduced some methods
like OGRFeature::DestroyFeature() so that an application could pass a feature
to the GDAL DLL to destroy instead of doing it in the parent application.

Also, using the GDAL or OGR C APIs you pretty much avoid the heap issues
since the C APIs leave all object allocation and destruction within the DLL.

However, I can see that it may be easier to write safe applications if you
use the same runtime library.  However, I haven't yet seen clearly that it
is necessary to have the GDAL DLL built with the same build options as
the parent application.

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