shared-libraries

using shared libraries vs single executable

My colleague claims that we should dissect our C++ application (C++, Linux) into shared libraries to improve code modularity, testability and reuse. From my point of view it's a burden since the code we write does not need to be shared between applications on the same machine neither to be dynamically loaded or unloaded and we can simpl...

Shared Libraries in Same Folder with App in TCSH

Hi, I am deploying a locally-compiled app to a remote Linux server. Since I don't have root account I cannot put needed shared libraries to /usr/lib Is there a way to overcome this? I put libraries in same folder and changed "path" variable but did not work. ...

Question on DLL Exporting/Importing and Extern on Windows

Hey guys i have some quick questions on windows dll. Basically i'm using the ifdefs to handle the dllexport and dllimport, my question is actually regarding the placement of the dllexports and dllimports as well as extern keyword. I am putting the dllimports/dllexports on the header files but do I have to put the dllexport and dllimpor...

Resolving axis2 and OC4J library conflicts.

I'm trying to deploy an Axis2 web service to an OC4J 10.1.3 app server. I was using axis 1.4 before and had just created my own shared library with all of the files. There was an issue with 1.4 that was patched with 1.5 so now I'm using that but it does not include all of the libraries. This time I deployed the axis2.war to the OC4J...

building a .so that is also an executable

So everyone probably knows that glibc's /lib/libc.so.6 can be executed in the shell like a normal executable in which cases it prints its version information and exits. This is done via defining an entry point in the .so. For some cases it could be interesting to use this for other projects too. Unfortunately, the low-level entry point y...

Parsley: Unable to execute command line tool after building it.. "Error while loading shared libraries: libparsley.so.0"

I'm getting started with Parsley (parslets.com), an interesting tool to parse data out of webpages. http://parselets.com/dev/command%5Fline I've downloaded the source, built it, and now I'm unable to run it: parsley: error while loading shared libraries: libparsley.so.0: cannot open shared object file: No such file or directory I'm...

ALSA not working when linked through a library

Hi, I'm experiencing a very strange behavior. I'm using alsa 1.0.18 on a powerpc platform. If I run the following simple code from the main of a .c file, it works perfectly, but if I put into a shared .so library (libaudio.so), then I link the main with -laudio -lasound, then the hwparams structure is not filled with anything, while th...

dynamic linking woes using c++

main.cpp <- line 106 to 164 invoke dlopen/dlsym/dlclose basefilter.hpp <- naked abstract base class basefilter.cpp examplefilter.hpp <- a test plugin examplefilter.cpp everything <- the repository Running the whole thing will result in the following error: Cannot open library "./libexamplefilter.so" ./libexamplefilter.so: undefined s...

Using otool (recursively) to find shared libraries needed by an app

I have a Cocoa app that uses otool to find required shared libraries that an app needs to function properly. For example, say I run otool -L on an app that uses QTKit.framework. I get a list of the shared libraries used by the program (including the basic frameworks like Cocoa.framework and AppKit.framework): /System/Library/Frameworks/...

Exporting shared library symbols in a crossplatform way?

Is there a cross platform way to selectively export certain functions and structs from a C project which builds a shared library? I want to do in a way that does not require a specific build system (the visibility should be defined in the code, eg as a macro), and in a way which both GCC and MSVC can understand. Thank you. ...

C++ static global non-POD: theory and practice

I was reading the Qt coding conventions docs and came upon the following paragraph: Anything that has a constructor or needs to run code to be initialized cannot be used as global object in library code, since it is undefined when that constructor/code will be run (on first usage, on library load, before main() or not at all). Even i...

Compiling a 'static' binary from fortran on mac

Hi, I would like to compile fortran code on mac such that it does not depend on any shared library. Ultimately, I want to be able to send the binary to other people and for it to just work (provided the processor has the right architecture). I noticed that g95 and ifort have a -static flag, which does not work on mac. If I consider the...

Qt: Writing plugins for other applications

I am writing a plugin for another application. I want to support the plugin on multiple platforms, so I am strongly considering using Qt. The plugin needs to be able to show some basic GUI. The plugin interface does not in any way handle GUI - it is just a simple DLL/shared library specified with a C-header file. Can I use Qt inside su...

CMake output name for dynamic-loaded library?

Hello! I'm trying to write cmake rules to build dynamic-loaded library for python using boost.python on linux. I'd like to use 'foo' for python module name. So, the library must be called foo.so. But by default, cmake uses standard rules for library naming, so if I write add_library(foo foo.cpp) I will get libfoo.so on output. Even s...

How to work (portably) with C++ class hierarchies & dynamic linked libraries

Ok, so I know portability is not the strong point of C++, but I have to get my code running on both Mac&Windows. I've come up with a solution, but it's not perfect, and I'm interested to see if there is someone out there who can suggest a better one. I need to us a class hierarchy in several DLLs/bundles - e.g., I have an abstract base ...

ld cannot find library that is installed

I'm sitting on an OpenSuse 11.1 x64 Box and I have a module that uses sigc++. When linking like this: g++ [a lot of o's, L's and l's] -lsigc-2.0 I get /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lsigc-2.0 However the library is there. In the filesystem: $ sudo find / -name "libsigc-2.0*"...

Why does compiling a shared object with GCC always result in undefined references to main?

I'm running Solaris, so it's possible that this is specific to running GCC on Solaris. If I use GCC to generate a shared object, and then run nm on it to see undefined symbols, there will always be a reference to main: [624] | 0| 0|NOTY |GLOB |0 |UNDEF |main If I manually generate the same shared object using ld,...

Static Global Fields in a Shared Library - Where do they go?

I have a cpp file from which I am generating a shared library (using autofoo and the like). Within the cpp file, I have declared a couple of static fields that I use throughout the library functions. My question is 2-part: 1) Where are these fields stored in memory? It's not as if the system instantiates the entire library and keeps ...

AIX- Does not install shared lib

I am able to build the shared object successfully using the holy native compiler "xlc" on AIX.It does build the shared object library but does not install the shared object library. Configure command is: ./configure --prefix=/PATH/to/install --exec-prefix=/PATH/to/install --enable-shared --enable-static=no --enable-module=so --build=pow...

Google perftool cannot read file "libprofiler.so.0"

Hi all, I am trying the google performance tool for CPU time profiling. However, I had encountered some problem that I cannot read the shared library file "libprofiler.so.0" I had read the README of google performace tool, there are 3 steps in the manual: Compile my program with -lprofiler. I had done this part without any problem. Ru...