shared-libraries

Visual Studio dll export issue for class and function template instantiations

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 03:18:52
问题 I am using VS2008 in win7 and g++ 4.7 in CentOS 18. The issue is only seen on Windows when I used dynamically shared library. When I convert it static library the program links fine. I understand that in shared library template functions/class either should be defined in header file or template instantiation of the template types(parameters) should be provided through compilation unit. I have chosen the later option. I have done it before, I went through Why can templates only be implemented

Load a DLL More Than Once?

孤者浪人 提交于 2019-12-19 01:07:10
问题 I'm using the LoadLibrary function to load a DLL in Windows. My question is this: If I call this method more than once for the same DLL, do I get handles to different instances of the DLL, or will they all refer to the same instance? Additionally, how does this behaviour correlate to Linux SO files, is it the same or completely different, and what assumptions can I make in this regard? Thanks. 回答1: The MSDN documentation states: The system maintains a per-process reference count on all loaded

virtualenv that can find relocated libraires (like mysqlclient lib for MySQLdb)

回眸只為那壹抹淺笑 提交于 2019-12-19 00:57:10
问题 I would like to be able to share a virtualenv that is self contained, i.e. insure that all scripts installed are able to run directly without needing to set anything. E.g. I install a script in my virtualenv that uses MySQL-python. Unfortunately importing MySQLdb looks for a shared library (libmysqlclient.so) that was moved elsewhere than the standard directories on my system. Is there a way to guarantee that my virtualenv will find the library every time someone uses it? 回答1: I know this

LD_PRELOAD affects new child even after unsetenv(“LD_PRELOAD”)

♀尐吖头ヾ 提交于 2019-12-18 16:39:06
问题 my code is as follows: preload.c, with the following content: #include <stdio.h> #include <stdlib.h> int __attribute__((constructor)) main_init(void) { printf("Unsetting LD_PRELOAD: %x\n",unsetenv("LD_PRELOAD")); FILE *fp = popen("ls", "r"); pclose(fp); } then in the shell (do the 2nd command with care!!): gcc preload.c -shared -Wl,-soname,mylib -o mylib.so -fPIC LD_PRELOAD=./mylib.so bash !!! be carefull with the last command it will result with endless loop of forking "sh -c ls". Stop it

Linking to Shared Library in Qt

蓝咒 提交于 2019-12-18 16:25:48
问题 I've just created tinyxml as a shared library, and would like to figure out how to link it. How is this accomplished? 回答1: You have to add includepath and libs in your pro file. Something like the following. Just change your paths. LIBS += -ltinyxml LIBS += -L/libs/tinyxml/lib INCLUDEPATH += /libs/tinyxml/include/ 来源: https://stackoverflow.com/questions/7182229/linking-to-shared-library-in-qt

Cross-Platform C++ Dynamic Library Plugin Loader

南笙酒味 提交于 2019-12-18 15:54:15
问题 I was just wondering what my options were for cross-platform implementations for the dynamic loading of plugins using shared libraries. So far the only one that I have found is: http://library.gnome.org/devel/glib/stable/glib-Dynamic-Loading-of-Modules.html And I was just wondering if I had other options? Essentially, I want to be able to put plugins in shared object files, and load them at runtime and I wanted to do it in a cross-platform C++ way. Edit : I found this Dr Dobbs Post from 2007;

cannot load shared library that exists in /usr/local/lib (Fedora x64)

我只是一个虾纸丫 提交于 2019-12-18 15:54:10
问题 When attempting to run a program I just compiled successfully, I get the following error: ./src/sensors/laser_scan_producer: error while loading shared libraries: liblcm.so.1 : cannot open shared object file: No such file or directory ls /usr/local/lib/liblcm* yields /usr/local/lib/liblcm.la /usr/local/lib/liblcm.so /usr/local/lib/liblcm.so.1 /usr/local/lib/liblcm.so.1.2.0 I have executed sudo ldconfig several times and added /usr/local/lib to LD_LIBRARY_PATH for the sake of redundancy. This

Version numbers in shared object files

无人久伴 提交于 2019-12-18 15:06:46
问题 I'm building a shared object file from a group of C++ source files using GCC. All the example tutorials on building .so files show the file created with a version number after the .so suffix. For example: gcc -shared -Wl,-soname,libmean.so.1 -o libmean.so.1.0.1 calc_mean.o This would produce the .so file libmean.so.1.0.1 Additionally, if I browse the /usr/lib directory on my local machine, I see that many of the .so files have version numbers at the end. However, when I compile a shared

ld cannot find -l<library>

不问归期 提交于 2019-12-18 14:18:29
问题 I am having trouble installing pyipopt on ubuntu 12.04. During linking, I receive the error: /usr/bin/ld: cannot find -lcoinhsl Even though I know that this library is installed and the .so and .la files are available in /home/mostafa/MyBuilds/CoinIpopt/build/lib/ does anyone have a solution for this? below is the complete return of running setup.py build: root@ubuntu:~/MyBuilds/pyipopt# sudo python setup.py build running build running build_ext building 'pyipopt' extension gcc -pthread -fno

If clang++ and g++ are ABI incompatible, what is used for shared libraries in binary?

人盡茶涼 提交于 2019-12-18 12:48:12
问题 clang++ and g++ are ABI incompatible, even for things as core as standard containers, according to, e.g., the clang++ website. Debian ships with C++ shared libraries, i.e. libboost, etc... that are compiled with ~something and user programs using both compiler generally work, and the library names aren't mangled with the compiler that was used for them. When you install clang, debian doesn't go and pull in duplicate versions of every C++ library installed on your system. What's the deal? Is