This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: A simple problem regarding shared libs...
- From: Andrea 'Fyre Wyzard' Bocci <fwyzard at inwind dot it>
- To: "Venkatakrishnan, V" <V dot Venkatakrishnan at channels dot usa dot xerox dot com>,gcc-help at gcc dot gnu dot org
- Date: Sat, 09 Feb 2002 02:36:13 +0100
- 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