[gdal-dev] Dropping dlopen/LoadLibrary loading of proj.4 ?

Alexander Mohr thehesiod at gmail.com
Wed Jun 21 21:20:12 PDT 2017

actually, even more importantly the reason to drop this is because it is wrong on linux.  When building gdal it will link to a specific version of libproj (ex libproj.so.3), with the current implementation, at runtime it will try to load libproj.so.  This does not existing in non -dev packages on purpose because it expects you to have a hard dependency to a versioned library so you won't accidentally load a version that's incompatible.

If a dynamic load is to be performed, it needs to remember the version that it was linked against, and not try to load the dev version.

Furthermore, the only reason to dynamically load the library is if it may not be available, but there currently is no fallback, you get an error that it can't load libproj.so.

So in fact the current implementation is broken in two ways.  It should just have a hard linker dependency against libproj.so.XX and if needed a flag that will cause all the methods to either not be available, or throw an exception if it was built w/o libproj support.

More information about the gdal-dev mailing list