System.loadLibrary() used, improved logging
This commit is contained in:
parent
d844699afc
commit
d2b861eb7f
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if DEBUG == 1
|
||||||
#define DEB(A) std::cout << A << std::endl
|
#define DEB(A) std::cout << A << std::endl
|
||||||
#else
|
#else
|
||||||
#define DEB(A) ;
|
#define DEB(A) ;
|
||||||
|
|
|
@ -19,9 +19,7 @@ fi
|
||||||
make installplugins
|
make installplugins
|
||||||
|
|
||||||
#prepare server
|
#prepare server
|
||||||
mkdir -p testserver/plugins/CppPlugins
|
|
||||||
cp target/Cppplugin-0.1-SNAPSHOT-final.jar testserver/plugins/
|
cp target/Cppplugin-0.1-SNAPSHOT-final.jar testserver/plugins/
|
||||||
cp target/libplugin.so testserver/plugins/CppPlugins
|
|
||||||
|
|
||||||
#start server
|
#start server
|
||||||
cd testserver
|
cd testserver
|
||||||
|
|
|
@ -76,7 +76,7 @@ void load(JNIEnv* env, long data) {
|
||||||
|
|
||||||
if(((!CPPPLUGINCLASS) + (!EVENTCLASS) + (!MAPCLASS) + (!LISTENERCLASS) //wenn eins == nullptr ist -> wird zu 1 -> endergebniss != 0 -> fehler
|
if(((!CPPPLUGINCLASS) + (!EVENTCLASS) + (!MAPCLASS) + (!LISTENERCLASS) //wenn eins == nullptr ist -> wird zu 1 -> endergebniss != 0 -> fehler
|
||||||
+ (!EVENTDATAF) + (!EVENTNAMEF) + (!PLUGINIDF)
|
+ (!EVENTDATAF) + (!EVENTNAMEF) + (!PLUGINIDF)
|
||||||
+ (!MAPGET) + (!MAPPUT) + (!MAPCLEAR) + (!LISTENERCONTR) + (!LISTENERSMALLCONTR)) == 0) {
|
+ (!MAPGET) + (!MAPPUT) + (!MAPCLEAR) + (!LISTENERCONTR) + (!LISTENERSMALLCONTR)) != 0) {
|
||||||
|
|
||||||
DEB("Error loading a information: ");
|
DEB("Error loading a information: ");
|
||||||
DEB("find classes: " << (!!CPPPLUGINCLASS) << (!!EVENTCLASS) << (!!MAPCLASS) << (!!LISTENERCLASS));
|
DEB("find classes: " << (!!CPPPLUGINCLASS) << (!!EVENTCLASS) << (!!MAPCLASS) << (!!LISTENERCLASS));
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class CppLoader implements PluginLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException {
|
public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException {
|
||||||
log.info("try to load: " + file.getName());
|
log.info("Loading " + file.getName());
|
||||||
return new CppPlugin(file, this);
|
return new CppPlugin(file, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,8 @@ public class CppPlugin implements Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean init() {
|
protected boolean init() {
|
||||||
File folder = CppPlugins.getInstance().getDataFolder();
|
|
||||||
folder.mkdirs();
|
|
||||||
String path = folder.getAbsolutePath() + "/libplugin.so";
|
|
||||||
getLogger().info("load library from: " + path);
|
|
||||||
try {
|
try {
|
||||||
System.load(path);
|
System.loadLibrary("plugin"); //loads libplugin.so from System.getProperty("java.library.path")
|
||||||
return init_();
|
return init_();
|
||||||
} catch(UnsatisfiedLinkError e) {
|
} catch(UnsatisfiedLinkError e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue