static jboolean libinit(JNIEnv *env, jobject obj, jint sdk) {
/*
#include <sys/system_properties.h>
int sdk;
char c[PROP_VALUE_MAX];
if(__system_property_get("ro.build.version.sdk",c) > 0) sscanf(c,"%d",&sdk);
else sdk = 8;
*/
__android_log_print(ANDROID_LOG_INFO,"liblossless","libinit: sdk=%d",sdk);
if(!libhandle) {
if(sdk < 8) libhandle = dlopen("/data/data/net.avs234/lib/libatrack8.so", RTLD_NOW);
else libhandle = dlopen("/data/data/net.avs234/lib/libatrack9.so", RTLD_NOW);
if(libhandle) {
libmedia_pause = (typeof(libmedia_pause)) dlsym(libhandle,"libmedia_pause");
libmedia_resume = (typeof(libmedia_resume)) dlsym(libhandle,"libmedia_resume");
libmedia_start = (typeof(libmedia_start)) dlsym(libhandle,"libmedia_start");
libmedia_stop = (typeof(libmedia_stop)) dlsym(libhandle,"libmedia_stop");
libmedia_write = (typeof(libmedia_write)) dlsym(libhandle,"libmedia_write");
libmediacb_start = (typeof(libmediacb_start)) dlsym(libhandle,"libmediacb_start");
libmediacb_stop = (typeof(libmediacb_stop)) dlsym(libhandle,"libmediacb_stop");
libmediacb_write = (typeof(libmediacb_write)) dlsym(libhandle,"libmediacb_write");
libmediacb_wait_done = (typeof(libmediacb_wait_done)) dlsym(libhandle,"libmediacb_wait_done");
}
}
__android_log_print(ANDROID_LOG_INFO,"liblossless","libinit: handle=%p",libhandle);
return libhandle != 0;
}
static jboolean libexit(JNIEnv *env, jobject obj) {
int ret = 0;
__android_log_print(ANDROID_LOG_INFO,"liblossless","libexit");
if(libhandle) {
ret = dlclose(libhandle) ? 0 : 1;
libhandle = 0;
}
return ret;
}
компиляция с Cygwin выдает ошибку:
/cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/objs/lossles
s / main.o: в функции libexit':
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:247: undefined referenc
e to
dlclose '
/ cygdrive / C / androidndk4 / приложения / без потерь / проект / бен / НДК / местные / armeabi / OBJS / lossles
s / main.o: в функции libinit':
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:226: undefined referenc
e to
dlopen '
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:228: неопределенная ссылка
e до dlsym'
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:229: undefined referenc
e to
dlsym '
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:230: неопределенная ссылка
e до dlsym'
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:231: undefined referenc
e to
dlsym '
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:232: неопределенная ссылка
e до dlsym'
/cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/objs/lossles
s/main.o:/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:233: more unde
fined references to
dlsym 'следовать
/ cygdrive / C / androidndk4 / приложения / без потерь / проект / бен / НДК / местные / armeabi / OBJS / lossles
s / main.o: в функции libinit':
/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:225: undefined referenc
e to
dlopen '
collect2: ld вернул 1 статус выхода
make: * [/ cygdrive / C / androidndk4 / apps / lossless / проект / bin / ndk / local / armeabi / l
iblossless.so] Ошибка 1