aboutsummaryrefslogtreecommitdiff
path: root/src/plugin/pluginmgr_dl.cpp
blob: f6b4ef3d223de65c1ecce7639f3a077342dc594a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <dlfcn.h>
#include <dirent.h>
#include <cstring>
#include "pluginmgr.hpp"
pluginManager::pluginManager()
{
	strcpy(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);
	}
	for(int i=0;i<fcnt;++i)
	{
		void* hso=dlopen(fn[i],RTLD_LAZY);
		if(!hso)continue;
		void* hndi=dlsym(hso,"getPluginInterface");
		if(!hndi)continue;
	}
}