![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Export Variable | navi | Shell Programming and Scripting | 2 | 06-10-2008 06:39 AM |
| Export variable as number | zeus101 | Shell Programming and Scripting | 2 | 10-16-2007 12:09 AM |
| problem while setting putenv | pgarg | High Level Programming | 3 | 09-03-2007 07:16 AM |
| export variable. | its-ashish | UNIX for Dummies Questions & Answers | 5 | 02-20-2007 06:24 AM |
| Export command giving Variable Name vs the Value set for the Variable | ParNone | UNIX for Dummies Questions & Answers | 2 | 04-03-2006 11:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
putenv() doesnt really export the variable
Hi, I am trying to export LD_LIBRARY_PATH variable using putenv() in my code. but when executing the binary, it still prompts for the necessary libraries. But when I export the LD_LIBRARY_PATH from command prompt using export, the binary is able to link to the libraries. Where am I going wrong?
|
|
||||
|
Let me understand. You call putenv() inside a program that relies on LD_LIBRARY_PATH?
You do know that dld() opens the runtime libraries BEFORE your putenv() code is called? How else could it access the external code for putenv? putenv is linked as a symbol reference that has to be dereferenced at runtime. So. Part of exectuable image activation is opening the runtime libraries. Do you have truss or strace or trace on your machine? If so, run your code under it. Note that before the executable runs the stuff you wrote it does a lot of file mapping and file opening. Most of that is shared libraries. One way - Instead of all this pain, statically link your exectuable against the library that now requiresLD_LIBRARY_PATH. Usually this means supplying the name of the .a form of the library on the command line (or makefile) Code:
cc myfile.c /some/odd/path/liboddlibrary.a -o myfile |
|
||||
|
Hi Jim, first of all..Thanx for the reply....
The code i am using has to link with shared libraries only. and other thing is that it is using set-uid. I read that when set-uid is used, the binary will ignore LD_LIBRARY_PATH and will look into only standard paths like /usr/lib. One option i am left with is to provide runtime path while compiling. Is there any other option... Please specify |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|