Hi ,
Thanks prashant for useful suggestion , now my program do not
give any errors but doesn`t show any output , I forward you code whose
shared library is to be please check what was the problem there .
On 1/9/06, Prashant Verma <[EMAIL PROTECTED]> wrote:
> *off list*
> When you compile the final program (the one that gives
> an error), how are you providing the library name to
> link with(in this case try.so)?
>
>
> I would suggest the following:
> a)When you create the file try.so, rename it instead
> to "libtry.so". Then register it using ldconfig.
> b)When you link with this library, use the additional
> flag "-ltry" on the gcc command line.
>
> Prashant Verma
>
> --- swapnil kamble <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> > I am Swapnil . I wanted to link the shared
> > libraries . Let
> > me tell you how I tried to link them but I am not
> > too sure whether it
> > is correct or not ,I did it according to tutorial .
> > I wrote some
> > libraries by using X lib for instance some header
> > "test.h" in which I
> > wrote function prototypes , a sample program
> > sample.c and body of
> > functions defined in header is in file def.c . As
> > all files are in
> > same dir then there no problem while compiling and
> > running . Next I
> > created Makefile it consists of following statements
> >
> > all:
> > gcc -lX11 -L/usr/X11R6/lib/ -lncurses -lm
> > sample.c def.c -o try
> >
> > till here everything is OK after this I modified
> > Makefile to create
> > shared libraries like this
> >
> >
> > all:
> > gcc -lX11 -L/usr/X11R6/lib/ -lncurses -lm
> > -shared sample.c
> > def.c -o try.so
> >
> > Shared object created successfully . then I copied
> > header test,h to
> > /usr/include then I copied try.so to /usr/X11R6/lib
> > then I run
> > command
> > #ldconfig
> > to update library database (No errors here)
> > Next If try to compile program , then I get error
> > for functions which
> > I have included
> >
> > , "sample.c:(.text+0x2a3): undefined reference to
> > `function_name'
> >
> > If you know something is wrong here or way is to do
> > it this then
> > please tell me immediately I would have been very
> > thankful to them .
> >
> > Hare Krishna
> > ...Swapnil
> >
> > _______________________________________________
> > ilugd mailinglist -- [email protected]
> > http://frodo.hserus.net/mailman/listinfo/ilugd
> > Archives at:
> > http://news.gmane.org/gmane.user-groups.linux.delhi
> >
> http://www.mail-archive.com/[email protected]/
> >
> >
>
>
--
...Swapnil
_______________________________________________
ilugd mailinglist -- [email protected]
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi
http://www.mail-archive.com/[email protected]/