how to compile the .so to allow extern functions

andy wang ypwangreg@gmail.com
Sat Dec 16 08:17:00 GMT 2006


Hi,  All

I want to compile a .so which contains extern function that may be
defined on the main program.
The following file can be compiled on linux without any problem but
how to compile it on cygwin?

$ cat bug1.c
//this will be .so and will call an extern func1() in the main proc
int func1();
int myfunc()
{
  printf("in myfunc.so");
  func1();
}

$ gcc -o bug1.so -shared bug1.c
/cygdrive/c/DOCUME~1/Flyiky/LOCALS~1/Temp/ccBB7v0l.o:
bug1.c:(.text+0x13): undefined reference to `_func1'
collect2: ld returned 1 exit status

Thanks in advance!

Regards,
Andy

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list