Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66125314
CelluloUnity_Cellulo.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 8, 11:14
Size
992 B
Mime Type
text/x-c
Expires
Mon, Jun 10, 11:14 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18135201
Attached To
R9807 cellulo-lua
CelluloUnity_Cellulo.cpp
View Options
#ifdef __ANDROID__
#include "CelluloUnity_Cellulo.h"
#include <dlfcn.h>
#include <QDebug>
jint load(JavaVM *vm, void *reserved, const char* so_file) {
jint (*that_jni_onload)(JavaVM *vm, void *reserved);
char *error;
void* handle = dlopen(so_file, RTLD_LAZY);
if (!handle) {
qDebug() << dlerror();
exit(EXIT_FAILURE);
}
*(void **) (&that_jni_onload) = dlsym(handle, "JNI_OnLoad");
if ((error = dlerror()) != NULL) {
qDebug() << error;
exit(EXIT_FAILURE);
}
return (*that_jni_onload)(vm, reserved);
}
jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
qDebug() << "Begin JNI_Onload()";
jint res = load(vm, reserved, "libQt5Core.so");
load(vm, reserved, "libQt5AndroidExtras.so");
load(vm, reserved, "libQt5Bluetooth.so");
load(vm, reserved, "libqtforandroid.so"); // FIXME: enables bluetooth. Does not work. See https://c4science.ch/T2160
qDebug() << "End JNI_Onload()";
return res;
}
#endif
Event Timeline
Log In to Comment