SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
-TARGET_LINK_LIBRARIES(${this_target} "-lvconf -ldlog")
+TARGET_LINK_LIBRARIES(${this_target} "-ldl -lvconf -ldlog")
SET_TARGET_PROPERTIES(${this_target}
PROPERTIES
#include <sys/prctl.h>
#include <sys/vfs.h>
#include <fcntl.h>
+#include <dlfcn.h>
#include <dlog.h>
#include <vconf.h>
#define _SECURE_LOGE(...)
#endif
-static const char* _OSP_COMPAT_SHARED_PATH = "/opt/usr/share/.osp-compat/\0";
-static const char* _EXT_OSP_HOME_PATH = "/opt/storage/sdcard/osp/\0";
+static const char _OSP_COMPAT_SHARED_PATH[] = "/opt/usr/share/.osp-compat/\0";
+static const char _EXT_OSP_HOME_PATH[] = "/opt/storage/sdcard/osp/\0";
+static const char OSP_COMPAT_LIB[] = "/usr/lib/osp/libosp-compat.so.1";
struct _path_info
{
char* app_rootpath = NULL;
int mmc_mounted = 0;
+ // preload libosp-compat.so.1 for compatibility
+ void* handle = dlopen(OSP_COMPAT_LIB, RTLD_GLOBAL);
+ if (handle)
+ {
+ LOGI("%s is preloaded.", OSP_COMPAT_LIB);
+ }
+
/* e.g., app_rootdir is "/opt/usr/apps/[pkgId] */
app_rootpath = get_app_rootpath_from_path(bin_path);