mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-30 08:03:49 +00:00
Android linker is really dumb, so made simple dlopen() based wrapper
to pull in the DNA/NaCl library and run the DNA main function from there. So now dna binary still works, but uses libdnalib, so that we don't need to duplicate NaCl library for dna binary versus access from in Java (once we make the JNI wrappers for the functions we care about).
This commit is contained in:
parent
cc500aeea2
commit
1fb83dbf0d
@ -43,8 +43,7 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES:= dnalib
|
||||
LOCAL_MODULE:= dna
|
||||
LOCAL_SRC_FILES:= null.c
|
||||
LOCAL_SRC_FILES:= dnawrap.c
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
11
dnawrap.c
Normal file
11
dnawrap.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
void *h = dlopen("/data/data/org.servalproject/lib/libdnalib.so",RTLD_LAZY);
|
||||
int (*dnamain)(int,char **) = dlsym(h,"main");
|
||||
if (!dnamain) return fprintf(stderr,"Could not load libdnalib.so\n");
|
||||
return (*dnamain)(argc,argv);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user