[gdal-dev] Linking against gdal201.dll with different MSVC versions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[gdal-dev] Linking against gdal201.dll with different MSVC versions

Idan Miara
Hi,

I'm developing a c++ MSVC (2013 or 2015) program that depends on GDAL.
Currently I'm using the C API, and I might use the C++ API in the future.

I've run dependency walker on the recent version of gdal201.dll that is distributed in osgeo4w, it depends on msvcr100.dll, thus I assume it was compiled with MSVC2010.

I was wondering if I could encounter problems with my program for linking against osgeo4w MSVC2010 gdal201 binaries while my program is compiled with MSVC 2013 or 2015. 
For that matter, does it make a difference if I use GDAL C API or the C++ API?

I see that GDAL can be compiled with MSVC2013 (gisinternals.com), and that QGIS master is built with MSVC2015. 
Is there a good reason for osgeo4w for keep choosing MSVC2010 for GDAL?

Kind Regards,
Idan.

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking against gdal201.dll with different MSVC versions

Even Rouault-2

On jeudi 2 mars 2017 11:32:11 CET Idan Miara wrote:

> Hi,

>

> I'm developing a c++ MSVC (2013 or 2015) program that depends on GDAL.

> Currently I'm using the C API, and I might use the C++ API in the future.

>

> I've run dependency walker on the recent version of gdal201.dll that is

> distributed in osgeo4w, it depends on msvcr100.dll, thus I assume it was

> compiled with MSVC2010.

>

> I was wondering if I could encounter problems with my program for linking

> against osgeo4w MSVC2010 gdal201 binaries while my program is compiled with

> MSVC 2013 or 2015.

> For that matter, does it make a difference if I use GDAL C API or the C++

> API?

 

Yes. You're probably safe if using different MSVC versions for your code and the GDAL build, if you use the C API (that's what QGIS does for example). If you use the C++ API, you'll need to use the same compiler and compiler settings.

 

>

> I see that GDAL can be compiled with MSVC2013 (gisinternals.com), and that

> QGIS master is built with MSVC2015.

> Is there a good reason for osgeo4w for keep choosing MSVC2010 for GDAL?

 

Probably because the last GDAL built in OSGeo4W was done with MSVC2010, before the recent upgrade to MSVC2015 for QGIS master. I guess the next GDAL builds will be done with MSVC2015 too.

 

Even

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking against gdal201.dll with different MSVC versions

Mateusz Loskot
In reply to this post by Idan Miara
On 2 March 2017 at 10:32, Idan Miara <[hidden email]> wrote:

> Hi,
>
> I'm developing a c++ MSVC (2013 or 2015) program that depends on GDAL.
> Currently I'm using the C API, and I might use the C++ API in the future.
>
> I've run dependency walker on the recent version of gdal201.dll that is
> distributed in osgeo4w, it depends on msvcr100.dll, thus I assume it was
> compiled with MSVC2010.
>
> I was wondering if I could encounter problems with my program for linking
> against osgeo4w MSVC2010 gdal201 binaries while my program is compiled with
> MSVC 2013 or 2015.
> For that matter, does it make a difference if I use GDAL C API or the C++
> API?

If you stick to GDAL C API and if you know what you are doing
and if you are careful, you should be fine.
GDAL DLL is fairly well isolated, especially in terms of allocations
and deallocations
which all happen inside GDAL DLL and do not cross the DLL/DLL or
DLL/EXE boundaries.
Read about "How should I deallocate resources acquainted from GDAL on
Windows?" here
https://trac.osgeo.org/gdal/wiki/FAQMiscellaneous

> Is there a good reason for osgeo4w for keep choosing MSVC2010 for GDAL?

Possibly, it's due to maintenance vs man power resources.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking against gdal201.dll with different MSVC versions

Idan Miara
Two great answers in 10 minutes! thanks guys!

On 2 March 2017 at 11:43, Mateusz Loskot <[hidden email]> wrote:
On 2 March 2017 at 10:32, Idan Miara <[hidden email]> wrote:
> Hi,
>
> I'm developing a c++ MSVC (2013 or 2015) program that depends on GDAL.
> Currently I'm using the C API, and I might use the C++ API in the future.
>
> I've run dependency walker on the recent version of gdal201.dll that is
> distributed in osgeo4w, it depends on msvcr100.dll, thus I assume it was
> compiled with MSVC2010.
>
> I was wondering if I could encounter problems with my program for linking
> against osgeo4w MSVC2010 gdal201 binaries while my program is compiled with
> MSVC 2013 or 2015.
> For that matter, does it make a difference if I use GDAL C API or the C++
> API?

If you stick to GDAL C API and if you know what you are doing
and if you are careful, you should be fine.
GDAL DLL is fairly well isolated, especially in terms of allocations
and deallocations
which all happen inside GDAL DLL and do not cross the DLL/DLL or
DLL/EXE boundaries.
Read about "How should I deallocate resources acquainted from GDAL on
Windows?" here
https://trac.osgeo.org/gdal/wiki/FAQMiscellaneous

> Is there a good reason for osgeo4w for keep choosing MSVC2010 for GDAL?

Possibly, it's due to maintenance vs man power resources.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking against gdal201.dll with different MSVC versions

Jürgen E. Fischer
In reply to this post by Even Rouault-2
Hi Even,

On Thu, 02. Mar 2017 at 10:43:16 +0100, Even Rouault wrote:
> Probably because the last GDAL built in OSGeo4W was done with MSVC2010,
> before the recent upgrade to MSVC2015 for QGIS master. I guess the next GDAL
> builds will be done with MSVC2015 too.

Well, if the third party dependencies (like filegdb - which I happend to start
and stop checking) were available that would already be in place.

Maybe I should just drop it in favor of openfilegdb - that's going to happen if
it's still not available when gdal switches to C++11.


Jürgen

--
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

attachment0 (844 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking against gdal201.dll with different MSVC versions

Even Rouault-2

On jeudi 2 mars 2017 11:14:07 CET Jürgen E. Fischer wrote:

> Hi Even,

>

> On Thu, 02. Mar 2017 at 10:43:16 +0100, Even Rouault wrote:

> > Probably because the last GDAL built in OSGeo4W was done with MSVC2010,

> > before the recent upgrade to MSVC2015 for QGIS master. I guess the next

> > GDAL builds will be done with MSVC2015 too.

>

> Well, if the third party dependencies (like filegdb - which I happend to

> start and stop checking) were available that would already be in place.

>

> Maybe I should just drop it in favor of openfilegdb - that's going to happen

> if it's still not available when gdal switches to C++11.

 

Ah those proprietary SDKs... I see FileGDB SDK 1.4 is available for VS2013. So perhaps an intermediate solution would be to build GDAL with VS2013 when we require C++11

I hope we'll stick with not so advanced C++11 features that will be OK with VS2013:

https://msdn.microsoft.com/en-us/library/hh567368.aspx

 

>

>

> Jürgen

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking against gdal201.dll with different MSVC versions

jmckenna
Administrator
In reply to this post by Jürgen E. Fischer
On 2017-03-02 6:14 AM, Jürgen E. Fischer wrote:
>
> Well, if the third party dependencies (like filegdb - which I happend to start
> and stop checking) were available that would already be in place.
>
> Maybe I should just drop it in favor of openfilegdb - that's going to happen if
> it's still not available when gdal switches to C++11.
>
Hi Jürgen,

In fact we recently decided to remove the FileGDB driver and go with the
OpenFileGDB driver, for the MS4W community, for this exact reason.

-jeff



_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Loading...