dlopen

What happens to the global variables in shared library when dlclose is called on it?

混江龙づ霸主 提交于 2020-01-01 06:13:15
问题 If a shared library (or a DLL) is being used through dlopen and dlclose mechanism and if the shared library created has some global variables whose memory comes from the heap, then what will happen to those variables and the memory when dlclose is called? If in the same process, dlopen is called again, what will be the behaviour? 回答1: If dlclose reduces the reference count to zero and the library is actually unloaded, any future reloading of the library should reset all variables with static

Difference between linking OpenMP with -fopenmp and -lgomp

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-01 02:38:06
问题 I've been struggling a weird problem the last few days. We create some libraries using GCC 4.8 which link some of their dependencies statically - eg. log4cplus or boost. For these libraries we have created Python bindings using boost-python. Every time such a library used TLS (like log4cplus does in it's static initialization or stdlibc++ does when throwing an exception - not only during initialization phase) the whole thing crashed in a segfault - and every time the address of the thread

dlopen on new binary with same name returns old handle

最后都变了- 提交于 2019-12-30 15:00:11
问题 I'm using dlopen to load dynamically generated code. The program calls the compiler on the code and generates a .so file which is then loaded by the program to extend itself. The problem is that if I use the same name for the generated code, the dlopen returns a handle to the old object, not the new one. The code looks like: …generate code into test.cpp system("gcc <args> test.cpp -o test.so"); void *handle = dlopen("test.so"); void *sym = dlsym(handle, "run"); (*sym)(); dlclose(handle); …Do

dlclose() doesn't work with factory function & complex static in function?

自古美人都是妖i 提交于 2019-12-30 05:29:23
问题 I'm making a simple plugin framework in which I'd like to be able to dlopen() a shared library (i.e. plugin), inspect and use whatever factory functions is provides and eventually dlclose() it, leaving no trace. My factory system is trivial, with a single exported function that returns a pointer to a common Base class. To check the plugin has been unloaded properly, I have a static object whose destructor sets a bool from the main program. Here's the main program: // dltest.cpp follows.

Is the function 'dlopen()' private API?

别说谁变了你拦得住时间么 提交于 2019-12-28 12:01:22
问题 I want use function 'dlopen()' to invoke a dynamic library on iOS platform, is the function 'dlopen()' private API? 回答1: I've had success using dlopen on iOS for years. In my use case, I use dlopen to load public system frameworks on demand instead of having them loaded on app launch. Works great! [EDIT] - as of iOS 8, extensions and shared frameworks are prohibited from using dlopen , however the application itself can still use dlopen (and is now documented as being supported for not only

Is the function 'dlopen()' private API?

 ̄綄美尐妖づ 提交于 2019-12-28 12:01:03
问题 I want use function 'dlopen()' to invoke a dynamic library on iOS platform, is the function 'dlopen()' private API? 回答1: I've had success using dlopen on iOS for years. In my use case, I use dlopen to load public system frameworks on demand instead of having them loaded on app launch. Works great! [EDIT] - as of iOS 8, extensions and shared frameworks are prohibited from using dlopen , however the application itself can still use dlopen (and is now documented as being supported for not only

Error: dlopen() Library not loaded Reason: image not found

社会主义新天地 提交于 2019-12-28 02:53:06
问题 I am a newbie in this field. My laptop is Macbook air, Software: OS X 10.8.5 (12F45). I am running a code which gives me the following error: dlopen(/Users/ramesh/offline/build_icerec/lib/icecube/phys_services.so, 2): Library not loaded: /Users/ramesh/offline/build_icerec/lib/libphys-services.dylib Referenced from: /Users/ramesh/offline/build_icerec/lib/icecube/phys_services.so Reason: image not found I did google search and found variety of answers. I think the one that works is to use "

“dlopen: Invalid argument” when loading native activity

最后都变了- 提交于 2019-12-25 02:46:48
问题 I'm using the following bootstrapping code to load my native activity (jngl-test): #include <android/native_activity.h> #include <android/log.h> #include <dlfcn.h> #include <errno.h> #include <stdexcept> const std::string LIB_PATH = "/data/data/com.bixense.jngl_test/lib/"; void* load_lib(const std::string& l) { void* handle = dlopen(l.c_str(), RTLD_NOW | RTLD_GLOBAL); if (!handle) { throw std::runtime_error(std::string("dlopen(") + l + "): " + strerror(errno)); } return handle; } void

dlopen: cannot load any more object with static TLS

可紊 提交于 2019-12-23 10:23:18
问题 I have a large mixed java/c++ application that loads multiple shared libs into java. It works fine on my Ubuntu 12.04 32-bit machine, but I'm having problems getting things to work on a Fedora 17 64-bit machine. Everything compiles fine, but when I try to run it I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: /pathto/libmylib.so: dlopen: cannot load any more object with static TLS Any help is greatly appreciated! UPDATE: I've narrowed this down to a problem with PCL (point

Debugging a crash when a library is opened via dlopen on OSX

时光怂恿深爱的人放手 提交于 2019-12-23 08:47:07
问题 I have a problem with a C++ application I've developed which uses dlopen to load user-developed libraries. The application has been used by a variety of people on a variety of linux distros and versions of OSX over the last couple of years and so I'm assuming my usage of dlopen is OK and so is the code that depends on it (yeah, this is hubris, so I'll report back when it fails). The problem I have now is that a user has developed a library which does not load on my system (OSX 10.6.4). When