shared-libraries

What actually happens when two shared libraries define the same symbol?

眉间皱痕 提交于 2019-12-11 04:41:58
问题 I recently encountered a crash issue when I linked two shared libraries (both made by myself) together. I eventually found it was because of one source file duplicated between the two files. In that source file a global std::vector was defined (in fact a static member of a class), and it ended up with being freed twice -- one by each library. I then wrote some test code to verify my thought. Here in a header I declare a class and a global object of this class: #ifndef SHARED_HEADER_H_ #define

how to install Fortran -dev package using sudo yum install

被刻印的时光 ゝ 提交于 2019-12-11 03:55:31
问题 I have installed (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5) already and jave also installed yum install gcc-gfortran . (Package gcc-gfortran-4.4.7-18.el6.x86_64) But I'm getting error like : /usr/bin/ld: cannot find -lgfortran collect2: error: ld returned 1 exit status make: *** [quadprog.so] Error 1 Please help me in installing -lgfortran. It seems like I need to install "Fortran -dev package providing the Fortran library". I do not know how to do that in RedHat/CentOS. Please help. I'm facing

C++: Undefined symbols when loading shared library with dlopen()

早过忘川 提交于 2019-12-11 03:50:05
问题 I have an issue when I try to use dlopen() to load a shared library into another shared library. I checked all tutorials on how to use dlopen() correctly. So here is the simplified code: The main shared library contains a class with pure virtual functions which the sub-shared library (aka plug-in) must implement. Additionally, it has some other functions which are implemented with a default behavior. I created a macro which is added to every plug-in to have a symbol to load and create the

Can I use shared objects with Go?

廉价感情. 提交于 2019-12-11 03:40:02
问题 Can I use shared objects with Go? 回答1: According to the Go FAQ, you can call into C libraries using a "foreign function interface": Do Go programs link with C/C++ programs? There are two Go compiler implementations, 6g and friends, generically called gc, and gccgo. Gc uses a different calling convention and linker and can therefore only be linked with C programs using the same convention. There is such a C compiler but no C++ compiler. Gccgo is a GCC front-end that can, with care, be linked

Why do I have to use LD_PRELOAD for libcl.2 to use XML::LibXML::Common on HP/UX?

江枫思渺然 提交于 2019-12-11 03:22:02
问题 A compulsion of LD_PRELOAD on HP platform only and not on other unix flavors (AIX,Linux, and Solaris). I built Perl Module XML::LibXML::Common on all of Unix flavors.I had to specifically do LD_PRELOAD for libcl.2 library on HP Platform only. While on other unix platforms nothing as such was required. Is this an OS behaviour or something really missing in HP loader/compiler? I was running a perl script which simply creates a new object of "XML::LibXML::SAX" use XML::LibXML::SAX; $x = XML:

atexit() function

非 Y 不嫁゛ 提交于 2019-12-11 03:03:05
问题 There are several tutorials which explains the usage of atexit() function such as: http://linux.die.net/man/3/atexit The examples are given in a main function which can be understood easily. However, I am creating a shared library in my program and I provide some functions to be exported from other programs. I want to stop some threads inside shared library when another program unloads my shared library. How can I use atexit() in my shared library implementation without forcing users to call

When do .so files get loaded Linux?

自古美人都是妖i 提交于 2019-12-11 02:35:29
问题 I have a shared object (a.so) which is linked to my executable myexe. a.so exposed a method called get_val(), which myexe is using. Now when a.so will be loaded into myexe's process address space? is it when myexe calls get_val() API, or when myexe gets launched. 回答1: There are two (three) types of libraries: static libraries (suffix: .a / .lib ), which itself becomes part of the binary. Strictly speaking, it's not the whole library, it's those objects from the library which are required to

Managing shared libraries in GlassFish Server Open Source Edition 3.1.2

余生长醉 提交于 2019-12-11 02:02:42
问题 What my question is all war files deployed in Glassfish are using same code base but with different database names , so libraries used in all war files are same. 1)Can Glassfish have shared lib folder similar to tomcat, if yes need steps. 回答1: Glassfish has shared libraris too, just copy your libraries in one of following directories and restart Glassfish. glassfish-3.1.2\glassfish\domains\domain1\lib : which will share libraries across all applications deployed to domain1 glassfish-3.1.2

What does the -fPIC compilation flag does?

落花浮王杯 提交于 2019-12-11 01:47:23
问题 What the -fpic flag does? I want to install a library (OpenSFM) and it is stated that it will need the Ceres Solver built and installed with the -fPIC compilation flag. The problem is I already installed the Ceres Solver without the -fPIC flag and other library already depended on it. How can I solve this? 回答1: A good explaination for -fPIC can be found here. I think the main question here is whether if you can still go ahead and install OpenSfM without rebuilding Ceres Solver. As far as I

Android N warning against .so file having W+E segments

℡╲_俬逩灬. 提交于 2019-12-11 01:38:58
问题 {.so filename} has W+E (writable and executable) load segments. This is a security risk shared libraries with W+E load segments will not be supported in a future Android release. Please fix the library. How can this be fixed? 来源: https://stackoverflow.com/questions/40504512/android-n-warning-against-so-file-having-we-segments