This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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] |
I am trying to build a DLL. The file testdll.c is: #include <stdlib.h> void not_exported(void){ printf("not_exported\n"); } void b(void){ printf("Called b\n"); not_exported(); } void a(void){ printf("Called a\n"); } and the testdll.def file is LIBRARY testdll EXPORTS ; Explicit exports can go here b @1 a @2 First, I build it with the command dllwrap --dllname=testdll.dll --def=testdll.def testdll.c Then I build the test program test-explicit.c #include <windows.h> int main(){ HINSTANCE handle; FARPROC f; handle=LoadLibrary("testdll.dll"); if (handle==0){ printf("handle=0\n"); exit(1); } f=GetProcAddress(handle,"b"); if (f==0){ printf("b=0\n"); exit(1); } f=GetProcAddress(handle,"a"); if (f==0){ printf("a=0\n"); exit(1); } exit(0); } with the command gcc -o test-explicit.exe text-explicit.c and run test-explicit.exe. No output, as expected. But, if the DLL is built with the command gcc -shared -o testdll.dll testdll.c testdll.def and test-explicit.exe is run, the output is a=0 . It seems thet the DLL created by gcc -shared is broken... Implicit linking works in both cases. Included are outputs of objdump -p : it seems that the only relevant difference is that, in the DLL created by dllwrap, exported symbols are in alphabetical order, while in the DLL created by gcc -shared, they are in numerical order. In fact, if the function "a" is renamed to "c", everything works. I am using Cygwin environment with gcc 3.2 20020927 and ld 2.13.90 20030308. Bye Fabrizio __________________________________________________________________ Tiscali ADSL, fino a 9 MESI GRATIS sull'offerta Tiscali ADSL Light Mega! Tiscali ADSL non teme confronti! Abbonati subito. http://point.tiscali.it/adsl/index.shtml
Attachment:
created_with_dllwrap.txt
Description: Text document
Attachment:
created_with_gcc_-shared.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |