diff --git a/core/metacling/src/TCling.cxx b/core/metacling/src/TCling.cxx
index 874dfcd6017226138eca8c8b801ea2111c1229dc..2a6841ba253f71d52444b65c2a9836f4dc56c5f4 100644
--- a/core/metacling/src/TCling.cxx
+++ b/core/metacling/src/TCling.cxx
@@ -1470,22 +1470,19 @@ static bool R__InitStreamerInfoFactory()
 
 bool TCling::LoadPCM(TString pcmFileName,
                      const char** headers,
-                     void (*triggerFunc)()) const {
+                     const std::string& libraryFullPath) const {
    // pcmFileName is an intentional copy; updated by FindFile() below.
 
+   assert(libraryFullPath.empty());
+   assert(llvm::sys::path::is_absolute(libraryFullPath));
    TString searchPath;
 
-   if (triggerFunc) {
-      const char *libraryName = FindLibraryName(triggerFunc);
-      if (libraryName) {
-         searchPath = llvm::sys::path::parent_path(libraryName);
+   searchPath = llvm::sys::path::parent_path(libraryFullPath);
 #ifdef R__WIN32
-         searchPath += ";";
+   searchPath += ";";
 #else
-         searchPath += ":";
+   searchPath += ":";
 #endif
-      }
-   }
    // Note: if we know where the library is, we probably shouldn't even
    // look in other places.
    searchPath.Append( gSystem->GetDynamicPath() );
@@ -1957,7 +1954,7 @@ void TCling::RegisterModule(const char* modulename,
 
    if (gIgnoredPCMNames.find(modulename) == gIgnoredPCMNames.end()) {
       TString pcmFileName(ROOT::TMetaUtils::GetModuleFileName(modulename).c_str());
-      if (!LoadPCM(pcmFileName, headers, triggerFunc)) {
+      if (!LoadPCM(pcmFileName, headers, dyLibName)) {
          ::Error("TCling::RegisterModule", "cannot find dictionary module %s",
                  ROOT::TMetaUtils::GetModuleFileName(modulename).c_str());
       }
diff --git a/core/metacling/src/TCling.h b/core/metacling/src/TCling.h
index 5295c8756e73afcabb63201d75042a2fe0e2582c..d0500c144c1f340117415b3db339e61151f784f6 100644
--- a/core/metacling/src/TCling.h
+++ b/core/metacling/src/TCling.h
@@ -568,7 +568,7 @@ private: // Private Utility Functions and Classes
    void AddFriendToClass(clang::FunctionDecl*, clang::CXXRecordDecl*) const;
 
    bool LoadPCM(TString pcmFileName, const char** headers,
-                void (*triggerFunc)()) const;
+                const std::string& libraryFullPath) const;
    void InitRootmapFile(const char *name);
    int  ReadRootmapFile(const char *rootmapfile, TUniqueString* uniqueString = nullptr);
    Bool_t HandleNewTransaction(const cling::Transaction &T);