Ver código fonte

COMP: add a dynamic loader for systems which don't support dynamic loading, so this is handled in kwsys and not every project using this has to care for it

Alex
Alexander Neundorf 18 anos atrás
pai
commit
220fe4f3ce
1 arquivos alterados com 56 adições e 1 exclusões
  1. 56 1
      Source/kwsys/DynamicLoader.cxx

+ 56 - 1
Source/kwsys/DynamicLoader.cxx

@@ -435,7 +435,62 @@ const char* DynamicLoader::LastError()
 #endif
 
 // ---------------------------------------------------------------
-// 5. Implementation for default UNIX machines.
+// 5. Implementation for systems without dynamic libs
+// __gnu_blrts__ is IBM BlueGene/L
+#ifdef __gnu_blrts__
+#include <string.h> // for strerror()
+#define DYNAMICLOADER_DEFINED 1
+
+namespace KWSYS_NAMESPACE
+{
+
+//----------------------------------------------------------------------------
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname )
+{
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  if (!lib)
+    {
+    return 0;
+    }
+
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+    DynamicLoader::LibraryHandle lib, const char* sym)
+{
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+const char* DynamicLoader::LibPrefix()
+  {
+  return "lib";
+  }
+
+//----------------------------------------------------------------------------
+const char* DynamicLoader::LibExtension()
+  {
+  return ".a";
+  }
+
+//----------------------------------------------------------------------------
+const char* DynamicLoader::LastError()
+  {
+  return "General error";
+  }
+
+} // namespace KWSYS_NAMESPACE
+#endif
+
+// ---------------------------------------------------------------
+// 6. Implementation for default UNIX machines.
 // if nothing has been defined then use this
 #ifndef DYNAMICLOADER_DEFINED
 #define DYNAMICLOADER_DEFINED 1