shared-libraries

CMake: how to produce binaries "as static as possible"

I would like to have control over the type of the libraries that get found/linked with my binaries in CMake. The final goal is, to generate binaries "as static as possible" that is to link statically against every library that does have a static version available. This is important as would enable portability of binaries across different...

Is the constructor of a class from a shared library exported?

I hav a a shared library lib.so containing a class Foo. I'm dynamically loading (with dlopen on UNIX) lib.so. After loading I want to create an instance of Foo. Can I simply use new operator to create an object of Foo, or I would have to create an exported factory method placed in lib.so that will create that object for me? Actually t...

LoadLibrary Reference Counting

From MSDN: The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count. Where is that reference count stored? ...

Making .war smaller!

There are several tutorials and even some posts here about shrinking .war files. However, the most common technique (to include grails.war.resources = {} in Config.groovy) does not seem to work for me. No matter what, grails dumps everything into the war file making a 25meg .war. Has this functionality changed? Grails 1.3.4 ...

How can I use Python Ctypes to override global WEAKREF function in a shared library library?

I understand I can set a global function pointer inside a sharef library to point to a python function as follows. from ctypes import * liblibrary = cdll.LoadLibrary('liblibrary.so') def py_library_hook(strings, n): return 0 # First argument to CFUNCTYPE is the return type: LIBRARY_HOOK_FUNC = CFUNCTYPE(c_int, POINTER(c_char_p), ...

How do applications resolve to different versions of shared libraries at run time ?

I'm a noob to how shared libraries work on linux. I am trying to understand how do applications resolve different revisions of the same shared library at run-time on linux. As far as I understand, a shared library has three "names", for example, libmy.so.1.2 (real-name i.e. the actual obj file) libmy.so.1 (SONAME, which is embedded ...

How to specify the library version to use at link time?

Following question http://stackoverflow.com/questions/3839756/how-do-applications-resolve-to-different-versions-of-shared-libraries-at-run-time, I wondered how to specify on the link command line which version of the library to use? Let's say I have libmy.so.1.0 libmy.so.1 -> libmy.so.1.0 libmy.so.2.0 libmy.so.2 -> libmy.so.2.0 l...

How to export pure virtual functions from a DLL in C++?

Hello, I am having a strange problem that no pure virtual function is exporting from a DLL. DLL compiles and outputs as .dll file to the directory . But it doesn't produce .lib file. If I give definition and it no longer remians as pure virtual, after that happily it creates .lib file. I need to implement factory pattern for which I n...

Overwriting library file causes segmentation fault

After I have the executable file running I overwrite its .so library file with a new version and this causes the executable to die with segmentation fault. I thought the library file is being accessed only when ELF file is loaded. Am I wrong? ...

Differences between a shared object and an ordinary library in Linux

What are the main differences between binding to a shared object or to an ordinary object? Also how is this possible to share some variables between some programs and knowing that our variables are never changed by another program? ...

How does linker know which symbols should be resolved at runtime?

How does linker know which symbols should be resolved at runtime? Particularly I'm interested what information shared object files carry that instruct linker to resolve symbols at runtime. How does the dynamic symbol resolution work at runtime, i.e. what executable will do to find the symbol and in case multiple symbols with the same nam...

ldd command searching libs at some arbitrary location

I ran truss command on executable and get the below output: stat64("/net/xyzmachine/vol/tools/solx64/studio11/SUNWspro/lib/rw7/librt.so.1", 0x080474A0) (sleeping...) stat64("/net/xyzmachine/vol/tools/solx64/studio11/SUNWspro/lib/rw7/librt.so.1", 0x080474A0) Err#2 ENOENT stat64("/net/xyzmachine/vol/tools/solx64/studio11/SUNWspro/lib/libr...

Is there a version of the VC++ 2008 Redistributable Package with the DEBUG dlls?

Hello All, We have a (mainly) C#/WPF application that invokes some C++ libraries via interop. For testing purposes (and because of some inconsistencies in a third party library), we would like to distribute a debug version or our application on a target machine, partially for remote debugging. In any case, when doing so, the program b...

How do I push specific changesets to a shared library repo in Mercurial?

I have a repo called MySharedLib, and another repo called MyProject. MySharedLib is included in many different repos by force-pulling (like a Jedi), and NOT using subrepos. If you clone MyProject, you are left with the following structure: /MyProject MySharedLib OtherStuff Files... MySharedLib is not a subrepo. Pulling in...

Shared vs dedicated php library

I have a server which consists of several Zend Framework application. I want to know if it is a good idea to upload Zend Library on the server and share it among all the applications instead of uploading it per application. Does it influence speed if for example multiple applications request a library simultaneously or not. What is it...

understanding shared libraries using gcc

I am trying to understand the following behavior of shared libraries in C Machine One $ cat one.c #include<stdio.h> int main() { printf ("%d", 45); } $ gcc one.c -o one -O3 $ ldd one linux-gate.so.1 => (0x00331000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00bc2000) /lib/ld-linux.so.2 (0x006dc000) $ cat two.c ...

Linking with new version of libpcap library

Hello, I would like to install and use latest version (1.1.1) of the libpcap on CentOS 5.5 machine. I configured, compiled and installed new libpcap library by: [dima@localhost libpcap-1.1.1]$ ./configure [dima@localhost libpcap-1.1.1]$ make [dima@localhost libpcap-1.1.1]$ sudo make install But when I'm trying to link with libpcap sh...

OpenMP library specification

hello , i am new to open mp and i tried an sample program from the official site #include <omp.h> #include <stdio.h> int main() { #pragma omp parallel printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads()); } and i have set the library in the eclipse as libgomp in project Properties->GCC c++ linker-...

OpenCV c++ application deployment with external libraries

Hi, I've tried searching A LOT for this with no luck (possibly because I'm not using the right technical terms). My issue is mainly to do with linking static libs, compiling and deploying. Before I get into details, my executables compile fine on my system; the main issue is how to deploy these as a working solution to others. I've wr...

method of converting a static library into a dynamically linked library

If all I have of a library is a *.a static library. Is there a way I can convert that to *.so dynamically linked library? Maybe using ld? I'm using SUSE Linux. ELF platform. ...