shared-libraries

Phonegap 3.3 Eclipse: -CordovaLib project missing Android properties

大兔子大兔子 提交于 2019-12-03 15:55:07
Trying to import new PhoneGap 3.3 project into Eclipse 4.3.1 - after initial phonegap CLI build I import 2 projects (HelloWorld and HelloWorld-CordovaLib). I get "The import org.apache.cordova cannot be resolved" error as CordovaLib seems not to be linked as library to the HelloWorld project. However, I am not able to flag the CordovaLib project in its Android properties as "Is library" (as per this post) because there is no Android section in its properties (the project seems not to behave as Android one). The Android properties of my HelloWorld shows CordovaLib in Library section but is has

NOT sharing all classes with shared library

自闭症网瘾萝莉.ら 提交于 2019-12-03 15:46:05
As ugly as win32 Microsoft compiler is by using the __declspec macro, it does have the advantage of being explicit about what you want to export or not. Moving the same code onto a Linux gnu/gcc system now means all classes are exported!(?) Is this really true? Is there a way to NOT export a class within a shared library under gcc? #ifndef WIN32 #define __IMPEXP__ #else #undef __IMPEXP__ #ifdef __BUILDING_PULSETRACKER__ #define __IMPEXP__ __declspec(dllexport) #else #define __IMPEXP__ __declspec(dllimport) #endif // __BUILDING_PULSETRACKER__ #endif // _WIN32 class __IMPEXP__ MyClass { ... }

How I can find function in shared object files using objdump and bash functions in linux?

我是研究僧i 提交于 2019-12-03 15:33:43
问题 I've got a folder in linux, which is contained several shared object files (*.so). How I can find function in shared object files using objdump and bash functions in linux? For instance, the following example is found me function func1 in mylib.so: objdump -d mylib.so | grep func1 But i want to find func1 in folder which is contained shared object files. I don't know bash language and how to combinate linux terminal commands. 回答1: nm is simpler than objdump , for this task. nm -A *.so | grep

Unknown reference to __dlopen in dlopen

删除回忆录丶 提交于 2019-12-03 15:32:05
dlopen is located in libdl.a but when I link my application against libdl.a , gcc linker throw this error : unknow reference to __dlopen called in dlopen Should I import another .a ? When I try to compile statically a dlopen mockup program, gcc (Archlinux/gcc version 4.6.1 20110819 (prerelease)) tells me: $ gcc test.c -ldl -static /tmp/ccsWe4RN.o: In function `main': test.c:(.text+0x13): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking and indeed, when I ran this script in /usr/lib/ for i in *.a; do echo

Force GCC to static-link e.g. pthreads (and not dynamic link)

僤鯓⒐⒋嵵緔 提交于 2019-12-03 15:04:04
My program is built as a loader and many modules which are shared libraries. Now one of those libraries uses pthreads and it seems its bound to the module dynamically (loaded on startup). Now it'd be simplier if i could force pthreads to be linked into the module file. GCC on linux, how do i do? I guess a libpthread.a is necessary.... Employed Russian While linking libpthread.a into a shared library is theoretically possible, it is a really bad idea . The reason is that libpthread is part of glibc , and all parts of glibc must match exactly, or you'll see strange and un-explainable crashes. So

what is the difference between .so and .a files?

家住魔仙堡 提交于 2019-12-03 15:04:02
问题 I am trying to compile a 3rd party library( on linux) and see that it is generating libsomething.a files I have my other libraries which are .so file But it appears that even .a is shared library and can be used just like a .so lib So is there any difference between the two ? or they are just same with different naming convention. 回答1: But it appears that even .a is shared library Nope, it's a static library. and can be used just like a .so lib If you mean linking to it, then yes. But you can

Getting undefined symbol error while dynamic loading of shared library

纵然是瞬间 提交于 2019-12-03 15:01:17
问题 I am getting undefined symbol error while loading library dynamically. Here is my code snippet that generates this error : int main () { void *lib_handle = NULL; MyClass* (*create)(); void (*destroy)(MyClass*); char *error; lib_handle = dlopen ("./libshared.so", RTLD_LAZY); if (lib_handle == NULL) { fprintf(stderr, "%s\n", dlerror()); exit(1); } create = (MyClass* (*)()) dlsym(lib_handle, "create_object"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); exit(1); } destroy =

Exceptions across binary boundary

你离开我真会死。 提交于 2019-12-03 14:57:25
问题 I know, this question has been asked quite some times, however I can't find a solution for my problem. I have the following situation: A / \ / \ B <-- C A is a shared library which contains the class EException B and C link against A C is a shared library as well B dynamically loads C at runtime At some point C throws an instance of EException : void doSometing() { throw EException("test-message"); } in B I would like to catch this exception: try { doSomething(); } catch (const EException& ex

nm reports symbol is defined but ldd reports symbol is undefined

寵の児 提交于 2019-12-03 14:06:57
问题 I'm having a linking problem. I need to link against a shared library libfoo.so that depends on a function read which I would like to define myself in the file read.c. I compile and link everything together but at runtime I get the error /home/bar/src/libfoo.so: undefined symbol: sread. nm reports the symbol is defined $nm baz | grep sread 00000000000022f8 t sread but ldd reports the symbol is undefined $ldd -r baz | grep sread undefined symbol: sread (/home/bar/src/libfoo.so) What gives? Is

Destructor of a global static variable in a shared library is not called on dlclose

China☆狼群 提交于 2019-12-03 13:44:11
In a main program, I dlopen and dlclose ( LoadLibrary and FreeLibrary respectively) a shared library. The shared library contains a static variable that is instantiated upon dlopen , and destroyed upon dlclose . This behavior is consistent on MSVC 2008 and 2013, GCC 3.4.6, and Sunstudio 12.1. With GCC 4.9.1 and GCC 5.2.1 however, the destructor was no longer called on dlclose . Instead, it was called before program exit. The particularity of the static variable's class, is that in the constructor, there is a call to a templated function get (of global scope) that returns a local static