A simple problem regarding shared libs...

Venkatakrishnan, V V.Venkatakrishnan@channels.usa.xerox.com
Mon Feb 11 09:38:00 GMT 2002


Hi Andrea,
	Thanks for the effort, but I still can't get it to work here.  It
seems that the linker goes looking only for .a files and doesn't even see
the .so in my directory.
I was Googling around regarding this and came across
http://oss.software.ibm.com/pipermail/icu/2001-November/004012.html, take a
look.
	I tried the -brtl switch but got a few more errors saying cannot
find libgcc.a.  I'm not too familiar with this switch or what it does, from
the way things are going it basically seems that my linker is only looking
for .a files and ignores .so (coz. I can get it to link using a static
library), is there a way I can tell it look for .so files as well??

Regards,
Venky

-----Original Message-----
From: Andrea 'Fyre Wyzard' Bocci [mailto:fwyzard@inwind.it] 
Sent: Friday, February 08, 2002 8:36 PM
To: Venkatakrishnan, V; gcc-help@gcc.gnu.org
Subject: Re: A simple problem regarding shared libs...


Hi

I've tried reproducing your problem, but on my machine everything went 
smoothly.
Also, I've not set LD_LIBRARY_PATH in any way. Just typed, and it worked !
(gcc 2.96 and gcc 3.0.2, binutils 2.11.90, linux 2.4.7, RedHat 7.2)

[fwyzard@stufis06 test]$ gcc sharobj.c -c -o sharobj.o [fwyzard@stufis06
test]$ gcc hello.c -c -o hello.o [fwyzard@stufis06 test]$ gcc sharobj.o
-shared -o libshared.so [fwyzard@stufis06 test]$ gcc hello.o -L. -lshared -o
hello [fwyzard@stufis06 test]$ ./hello Hello World Hello from shared lib

Here's the files I've used:
/* hello.c */
#include <stdio.h>

extern const char* func();
int main( void)
{
         printf("Hello World\n");
         func();
         return 1;
}
/* end of hello.c */

/* sharobj.c */
#include <stdio.h>

const char* func(void)
{
         printf("Hello from shared lib\n");
}
/* end of sharobj.c */

fwyzard



More information about the Gcc-help mailing list