![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| dynamic linking of folder name in makefile | phani_sree | High Level Programming | 1 | 07-25-2007 05:49 AM |
| differeEEK!nce between static and dynamic linking | vijaya2006 | High Level Programming | 1 | 03-03-2006 05:12 AM |
| Linking with gcc | jbeauchamp | High Level Programming | 1 | 02-14-2005 10:26 AM |
| dynamic linking in gcc | collins | High Level Programming | 0 | 09-14-2004 08:48 AM |
| Linking problem while linking to shared library | laho | High Level Programming | 6 | 03-16-2004 06:01 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
dynamic linking
Hi,
Could any one tell me solution for this. i have a library in my /usr/lib and latest in /myhome/lib/ (thay differ functionality symbols my application uses symbols from latest lib). when compile and link my application , every thing goes fine but when running the application ld loads this library from /usr/lib i want it to take this libary from /myhome/lib instead of /usr/lib how can i tell this to ld.so i heard of LD_CONFIG env variable(if any one knows how to use it plz let me know) any help would be highly appreciated |
| Forum Sponsor | ||
|
|
|
|||
|
Set the SONAME of the library to it's full path
as in $(CC) -shared -W1,-soname,/myhome/lib/libfoo.so foo.o -o /myhome/libfoo.so then when an application links against it the full path will be recorded. confirm with ldd. Also you may want to look at -rpath |
|
|||
|
If this is production code, don't link against your own directory tree. Terrible idea. Instead compile your shared library into a archive (.a). Link statically against the .a file.
cc myprogram.c /myhome/lib.libwhatever.a -o myprogram The executable image will then run pretty much anywhere, on any system that supports the archictecture on your development system - and that has the same libc The downside is that the app will use more memory. |
|||
| Google UNIX.COM |