aboutsummaryrefslogtreecommitdiff
path: root/src/plugin
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-10 23:25:14 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-10 23:25:14 +0800
commitf54345e4fc889471513cba99151a5e6a2dcef2d8 (patch)
tree0751093de4a8656ae24b139bf669f3f0a78ea417 /src/plugin
parentc108631ffb580cfed1e92b1a0713e11d8dcbdddd (diff)
downloadbullet-lab-remix-f54345e4fc889471513cba99151a5e6a2dcef2d8.tar.xz
This fixed yesterday's problem...
In fact there was no object slicing, but it was due to my laziness... I reused the code from BLR2 in bullet.hpp and there was no inheritance in BLR2... Also start the implementation of the plugin system.
Diffstat (limited to 'src/plugin')
-rw-r--r--src/plugin/pluginmgr.hpp15
-rw-r--r--src/plugin/pluginmgr_dl.cpp20
2 files changed, 35 insertions, 0 deletions
diff --git a/src/plugin/pluginmgr.hpp b/src/plugin/pluginmgr.hpp
new file mode 100644
index 0000000..e3220c1
--- /dev/null
+++ b/src/plugin/pluginmgr.hpp
@@ -0,0 +1,15 @@
+#ifndef PLUGINMGR_H
+#define PLUGINMGR_H
+class pluginManager
+{
+private:
+ char fn[256][256];
+ int fcnt;
+ char pluginFolder[256];
+public:
+ pluginManager();
+ void scanPlugin();
+ void loadPlugin(const char* filename);
+};
+#endif
+
diff --git a/src/plugin/pluginmgr_dl.cpp b/src/plugin/pluginmgr_dl.cpp
new file mode 100644
index 0000000..f3ab816
--- /dev/null
+++ b/src/plugin/pluginmgr_dl.cpp
@@ -0,0 +1,20 @@
+#include <dlfcn.h>
+#include <dirent.h>
+#include "pluginmgr.hpp"
+pluginManager::pluginManager()
+{
+ pluginFolder="./plugins";
+}
+void pluginManager::scanPlugin()
+{
+ DIR *dir;
+ struct dirent *file;
+ if(dir=opendir(pluginFolder))
+ {
+ while(file=readdir(dir))
+ //puts(file->d_name);
+ if(strcmp(file->d_name+strlen(file->d_name)-3,".so")==0)
+ strcpy(fn[fcnt++],file->d_name);
+ closedir(dir);
+ }
+}