Hi,
I created two library libsum.so and libproduct.so. In the libproduct.so is defined function "product" that use function "sum" defined in libsum.so. So libproduct depends on libsum.
In main function I called product function by a dlopen request. Unfortunaly, when I execute program I have an error: symbol lookup error, undefined symbol sum. Why this? I don't open sum function with another dlopen request. This solution resolve problem but is, in generally, a bad solution because the main function developer can not say that product depends on sum. Is there another solution?
Plese help me, Thanks to all and nice week-end.
I paste code below.
Last edited by pludi; 12-18-2009 at 01:06 PM..
Reason: code tags, please...
I am assuming you are playing dynamic loading. the symbol sum is undefined, period.
You will have to load the symbol for it in the prod module, since it the only module that knows about it.
You now see why the normal way to link is to allow the link editor to resolve ALL symbols before runtime.
Since you are dynamically loading libraries, consider making sum a static module in the prod library - assuming you are trying to abstract (hide from view) symbols.
Why would you think it was unnecessary? Someone has to know that the product library needs the sum library...if you don't link it, the dynamic loader won't know to pull it in when loading product. If the dynamic loader doesn't know to do it, you need to do it yourself.
ldconfig command adds new library libsum and libproduct in system library cache (printable with ldconfig -p command), so I thought that the linker searched the library to resolve symbol "sum" in the default list like do with standard C lib. In fact if I use fprints function I don't have to link the library that resolve symbol "fprints". But I was wrong.
hello
I apologize if my question bothers you
I work on a code developed in C + + which worked well on mac os, this code will help create libraries *.so from *.cc and *.h I used this as flags:CXXFLAGS = -g -O2 -fPIC -Wall -ldl -D_GNU_SOURCE ,CXX := g++ and $(CXX)-shared -o $(LIBNAME) $(CLIBLIB)... (0 Replies)
I am attempting to port a program from OS X to Linux. It's C++ & Qt Creator and I did the original Windows to OS X port, so I tried to make it as POSIX-compliant as possible; the OS X port works well, and the Linux port builds and starts (it's on Ubuntu 9.10) but has some issues running.
The... (2 Replies)
I am having a major problem. Most of the commands that i am running on my centos 5 system is giving the error of type:
<dynamic shared library file>:open failed: No such file or directory
For example:
libgcc_s.so.1: open failed: No such file or directory
How can i solve this? (6 Replies)
Hi,
I wonder how can we override the dynamic library loaded by ld on start up.(dynamic linked application). so that linker uses the new library to find symbols.
Is it possible to do.
Cheers. (4 Replies)
Trying to run an X11 executable under Darwin, I keep getting:
dyld: Library not loaded: /sw/lib/libglib-1.2.0.dylib
Referenced from: /usr/X11R6/bin/wav2rsomac
Reason: image not found
Trace/BPT trap
I can't figure out if this is an error in the way the program is running, or if the... (0 Replies)
Hi,
I have a small test c program which tries to dlopen a shared library(libjvm.sl).
But i get error as "Can't dlopen() a library containing Thread Local Storage"
My program is as below
when i run the program i get error
any pointers why the error??
I am using hp-ux . The... (1 Reply)
I need to load a dynamic library from a statically linked program. Is there a way without recompiling my program.
when i try to do that my program just crashes.
If not possible, how can I avoid crashing the program when i try to load the dynamic lib, again without recompiling.
If my... (1 Reply)
hi, every body. i have in trouble that how to load a dynamic library by hand.
for example, i know how to generate a dynamic library and how to link a dynamic library in makefile.
generate a dynamic library:
add -dy -G behind cc
link a dynamic library in makefile:
add -dy -Bdynamic behind cc... (0 Replies)