Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abilty to not include CPLGetSymbol when not building plugins #11332

Closed
schwehr opened this issue Nov 22, 2024 · 1 comment · Fixed by #11383
Closed

Abilty to not include CPLGetSymbol when not building plugins #11332

schwehr opened this issue Nov 22, 2024 · 1 comment · Fixed by #11383
Assignees

Comments

@schwehr
Copy link
Member

schwehr commented Nov 22, 2024

Feature description

Before RFC 97 PR #8695 / 8821682, I was able to build without CPLGetSymbol in my custom environment that has no plugins. I'm still able to do that with some custom patches, but it would be nice to have this be a general option. The most common use case is likely for folks that are trying to run GDAL in a sandbox that restricts the syscalls that are allowed.

I would make a PR for this, but I'm guessing there would be some unintended consequences.

I don't include port/cplgetsymbol.cpp in my build and the patch I have right now is as follows for a base of 3968f9c:

diff --show-c-function -u {a,b}/gcore/gdaldrivermanager.cpp
--- a/gcore/gdaldrivermanager.cpp	2024-11-22 06:21:56.514903847 +0000
+++ b/gcore/gdaldrivermanager.cpp	2024-11-22 06:22:39.414793757 +0000
@@ -1370,6 +1370,8 @@ GDALDriver *GDALPluginDriverProxy::GetRe
     }
     else
     {
+        return nullptr;
+#if 0
         CPLString osFuncName;
         if (STARTS_WITH(m_osPluginFileName.c_str(), "gdal_"))
         {
@@ -1433,6 +1435,7 @@ GDALDriver *GDALPluginDriverProxy::GetRe
                 poDriverManager->m_oMapRealDrivers.erase(oIter);
             }
         }
+#endif
     }

     if (m_poRealDriver)

Additional context

No response

@rouault
Copy link
Member

rouault commented Nov 22, 2024

@schwehr I see the calls to CPLGetSymbol() that pre-existed RFC 97 are protected within the #else branch of #ifdef GDAL_NO_AUTOLOAD. Perhaps you can do a pull request for the extra calls that have been added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants