[gdal-dev] Linking MinGW app builds against VC++ built GDAL
Frank Warmerdam
warmerdam at pobox.com
Mon Feb 11 12:46:02 EST 2008
Folks,
A few weeks or perhaps months ago there was some discussion about wanting
to use MinGW to build applications against a GDAL library built with VC++.
The main barrier to making this work was that VC++ builds a bunch of C
entry points with stdcall convensions instead of the default cdecl. MinGW
did not recognise this and so linking failed.
At the time I more or less blew off the fellow I was corresponding with (I
can't seem to find this discussion now) stating it was an MinGW problem, not
a GDAL problem.
Somewhat ironically, I now find myself wanting to do the same thing - basically
so that OSGeo4W's GRASS (built with MinGW) can be built against a common GDAL
DLL built with VC++. In exploring somewhat deeper I determined the problem was
just that cpl_port.h only declares CPL_STDCALL to be __stdcall for VC++ due
to the #ifdef's.
I have modified cpl_config.h.vc so that it forces CPL_STDCALL to always be
used, regardless of the compiler pulling in the include file. This seems to
fix the problem, and I have incorporated it in trunk and 1.5 branch per:
http://trac.osgeo.org/gdal/ticket/2216
Anyone interested in using MinGW to build applications against a GDAL built
with VC++ (such as the stock GDAL binaries) is encouraged to apply this hack
and report back if they find out issues. I am now personally willing to
support this particular configuration.
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 | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list