shared-libraries

How to initialize a shared library on Linux

て烟熏妆下的殇ゞ 提交于 2019-12-18 11:31:32
问题 I am developing a shared library using C++ under Linux, and I would like this library to use log4cxx for logging purposes. However, I'm not sure how to set this up. For log4cxx to work, I need to create a logger object. How can I make sure this object is created when my library is loaded? I suspect that it will be easiest to create the logger object as a global variable and then use it from any of the source files of my library, declaring it as extern in the headers. But how can I have the

How to initialize a shared library on Linux

≯℡__Kan透↙ 提交于 2019-12-18 11:31:26
问题 I am developing a shared library using C++ under Linux, and I would like this library to use log4cxx for logging purposes. However, I'm not sure how to set this up. For log4cxx to work, I need to create a logger object. How can I make sure this object is created when my library is loaded? I suspect that it will be easiest to create the logger object as a global variable and then use it from any of the source files of my library, declaring it as extern in the headers. But how can I have the

Recommendation for C++ wrapper for cross platform in-process dynamic library bindings (i.e. a lightweight, high performance COM or CORBA) [closed]

不羁岁月 提交于 2019-12-18 11:12:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . We're developing an application that will have a plug-in "architecture" to allow consumers of the app to provide their own proprietary algorithms. (We will basically have a set of parsers and allow third parties to provide their own as well) The domain space requires very high performance, so out-of-process

How compatible are different versions of glibc?

孤人 提交于 2019-12-18 11:03:29
问题 Specifically: Is it assured somehow that all versions of glibc 2.x are binary compatible? If not, how can I run a binary (game) on my system which has been compiled for a different version? Can I install glibc in a different folder? My specific problem is the compatibility between glibc 2.14 (what I have) and 2.15 (what the game wants). I might also get a version for glibc 2.13 but I'm not sure if that will run on 2.14. 回答1: In general, running binaries that were compiled for an older glibc

Remote Post-mortem coredump analysis without having exact debug symbols for shared system libraries

微笑、不失礼 提交于 2019-12-18 10:48:14
问题 How do you usually get around this problem? Imagine that a thread crashes inside libc code (which is a system shared library) on Computer1 and then generates a coredump. But the Computer2 on which this coredump will be analysed might have a different version of libc. So: How important it is to have the same shared library on the remote computer? Will the gdb correctly reconstruct stacktrace without having exact same version of libc on Conputer2? How important it is to have correct debug

Why is fPIC absolutely necessary on 64 and not on 32bit platforms?

可紊 提交于 2019-12-18 10:20:03
问题 I recently received a: ...relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC error while trying to compile a program as a shared library. Now the solution to this is not too difficult (recompile all dependencies with -fPIC), but after some research it turns out that this problem is only present on x86-64 platforms. On 32bit any position dependent code can still be relocated by the dynamic loader. The best answer I could find is:

How to create an extension to already wrapped library via SWIG?

白昼怎懂夜的黑 提交于 2019-12-18 09:44:08
问题 I have a library. It is wraped via SWIG. I want to create a plugin to extend it. Plugin requires a class from already wrapped library to run having something like void init( oldT old); . Library is used from Java and c#. Now this plugin also will be used from there. Library and plugin are separate dll's. How to tall SWIG that I already have that oldT type wrapped when creating binding for plugin? 回答1: You're looking for %import in the .i file of your plugin. You'll need to either have (or

Flag '-l' in CMAKE_CXX_FLAGS doesn't work

爱⌒轻易说出口 提交于 2019-12-18 09:06:58
问题 I have some code I wrote on my mac machine and it has been working perfectly but when I port it over to a Linux machine I get an undefined reference to curl_easy_init My compiler flags include a -lcurl for linking. Here's how I'm linking: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -L/curl/lib/dir -lcurl") I've tried with and without the -L/curl/lib/dir Curl is installed on this machine: $ curl --version curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1

Identifying which Linux system library contains a function

我只是一个虾纸丫 提交于 2019-12-18 07:39:31
问题 I am using a dev system where I have to specify the lib name when accessing a function inside it. I've used functions like open() before, and somehow found out that they're in libc.so. Now I want to use lstat(), but it appears that this one is not in libc. Sadly, the man pages I looked at do not document the location of the functions. So, two questions: Can someone tell which lib hosts lstat? How can I generally find this out? Other than using grep "name" on all files in the lib folder, I

undefined symbol for self-built llvm opt?

若如初见. 提交于 2019-12-18 06:58:03
问题 I write a simple llvm plugin pass that requires opt to load xxx.so file and run a ModulePass. The strange thing is that when I use deb package opt (e.g., from apt-get , let's call it opt-3.7 ), the plugin works fine (the drawback is that it is a Release build); however when I use the opt I build myself (simplify call it opt ), it frequently complains: Error opening 'xxx.so': xxx.so: undefined symbol: _ZNK4llvm12FunctionPass17createPrinterPassERNS_11raw_ostreamERKNSt7__cxx1112basic