This is the mail archive of the cygwin mailing list for the Cygwin 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: how to compile the .so to allow extern functions


Hi, All:


$ gcc -shared -o bug1-main.so bug1-main.c -ldl -Wl,--out-implib=libmain.dll.a Creating library file: libmain.dll.a $ gcc -shared -o bug1.so bug1.c -L. -lmain $ gcc -o bug1-main bug1-main.c -ldl $ ./bug1-main.exe in myfunc.so in main.func1()

This method is wrong, because the bug1.so still depends on
bug1-main.so, so if I delete the bug1-main.so it will do nothing!

The correct method should be:

bug1-main.c ==> __declspec(dllexport) int func1()
gcc -c bug1-main.c
dlltool.exe --export-all --output-def bug1-main.def bug1-main.o
gcc -o bug1-main bug1-main.c -ldl
dlltool.exe --dllname bug1-main.exe --def bug1-main.def --output-lib
libbug1-main.dll.a
gcc -shared -o bug1.so bug1.c -L. -lbug1-main // or gcc -shared -o
bug1.so bug1.c libbug1-main.dll.a

Reference:
http://mail.python.org/pipermail/python-list/2002-May/143575.html

My question is why the --export-dynamic doesn't work ?
gcc -Wl,--export-dynamic -o bug1-main bug1-main.c -ldl

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/


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