]> git.lizzy.rs Git - dragonblocks3d.git/blobdiff - later_use/dynamiclibrary.cpp
New structure
[dragonblocks3d.git] / later_use / dynamiclibrary.cpp
diff --git a/later_use/dynamiclibrary.cpp b/later_use/dynamiclibrary.cpp
new file mode 100644 (file)
index 0000000..e450931
--- /dev/null
@@ -0,0 +1,26 @@
+// Just some code to use later when C++ Runtime Mods are introduced
+
+class DynamicLibrary
+{
+       public:
+       std::string filename;
+       std::string error;
+       bool success;
+       void *handle;
+       DynamicLibrary(std::string);
+};
+DynamicLibrary *loadDynamicLibrary(std::string); 
+
+DynamicLibrary::DynamicLibrary(std::string f)
+{
+       filename = f;
+       
+       handle = dlmopen(LM_ID_BASE, filename.c_str(), RTLD_NOW | RTLD_GLOBAL);
+       
+       if (handle) {
+               success = true;
+       } else {
+               error = dlerror();
+               success = false;
+       }
+}