I am working on a project where I am attempting to use GDAL and ArcObjects together in the same project. Although the project itself is nothing more than a toolbar in ArcMap, I would like to use some GDAL based raster libraries developed for other non-ArcMap projects that offer a SIGNIFICANT performance boost over the equivalent ArcObject based methods.

I've been getting all types of crazy errors when mixing the two. However, when I execute the same chunks of code in localized (either GDAL alone or ArcObjects alone) projects, everything works as expected.

Can ArcObjects and GDAL co-exist in the same project? Any tips to avoid complications?

FYI - I am using the C# GDAL bindings distributed with FWTools 2.4.7.

  • 2
    please elaborate on "crazy errors" - any specific exceptions? – Kirk Kuykendall Jan 24 '11 at 21:36
  • Do you have any stack trace snippets? – WolfOdrade Jan 24 '11 at 22:50
  • Errors are wide ranging. One example is when I try to connect to a file geodatabase via IGxDialog - I get a "failed to connect to database. cant load format dll". Another example is trying to open a feature class using IGPUtilities, I get error about xerces-c_2_7.dll – user890 Jan 25 '11 at 13:20

Without seeing the errors themselves, I'd guess offhand that you're seeing DLL Hell conflicts between the version of GDAL you're using and the version that ESRI ships. (Yes, ArcObjects uses GDAL under the hood.)

Windows will only load one copy of a DLL into an application's address space (insert big IIRC disclaimer here) and I'm guessing that which one gets loaded depends on which code path you use first.

Try using GDALCheckVersion liberally to see if there are version issues, and perhaps roll back to a version of the FWTools wrappers built for the exact gdal.dll version you'll find in with all the ArcObjects DLLs.

  • 1
    This is exactly the issue. You will see all kinds of symbol conflicts/DLL version mismatch issues. – Jason Scheirer Jan 24 '11 at 23:28
  • 3
    It should be possible to link against the GDAL build that ArcObject used (or an approximation of that based on tracking Frank's 1.6 ESRI branch, but you'd have to build everything yourself in that instance). svn.osgeo.org/gdal/sandbox/warmerdam/1.6-esri – Howard Butler Jan 25 '11 at 3:46
  • 1
    GDAL isn't thread safe so even if you are using the same DLL you could still have conflicts. Spawn a seperate process for the GDAL code. – Matthew Snape Jan 26 '11 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.