[gdal-dev] Linking MinGW app builds against VC++ built GDAL

Ari Jolma ari.jolma at tkk.fi
Tue Feb 12 13:32:25 EST 2008


Frank,

I'd like to try this, i.e., build the Perl bindings with MinGW against 
such DLL. But since I'm not willing to build GDAL DLL with VC++, I'd 
need to download them from someplace. Can I?

Regards,

Ari

Frank Warmerdam kirjoitti:
> 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,


-- 
Prof. Ari Jolma
Geoinformatiikka / Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the gdal-dev mailing list