View Single Post

  #2 (permalink)  
Old 10-18-2006, 03:28 AM
rockdalinux's Avatar
rockdalinux rockdalinux is offline
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Hi!

Well I am not pro @ C/C++ I have just started to learn for my college studies. Here is what we do in lab:

After creating shared lib you need to execute command (note . after -n option):
Code:
ldconfig -v -n .
Then setup linker name (for exmple if your lib name is libmyapp then it should be as follow
Code:
ln -sf libmyapp.so.0 libmyapp.so
Now compile your program
Code:
gcc -Wall -g -c mytestprog.c -o mytestprog.o
Now build and link (note . after -L option)
Code:
gcc -g -o mytestprog mytestprog.o -L. -llibmyapp
To execute program (note . )
Code:
LD_LIBRARY_PATH="."
./mytestprog
Read man page of ldconfig and gcc for more info.
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote