This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]