This is the mail archive of the cygwin@sources.redhat.com 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]

ld -shared (binutils-20000722-1) does not support NONAME in .def


Another problem for which I could not find documentation.
ld -shared (binutils-20000722-1 has problems with the NONAME attribute
in .def files.

For example (modified from Mumit's dllhelpers-0.2.5/c):

This def (mycdll.def)

EXPORTS
 dll_global_int_var @1 DATA
 dll_int_square NONAME @2
 dll_set_global_int_var @3
 dll_double_square @4
 dll_get_global_int_var @5
 dll_float_square @6

and this command

    gcc -shared -Wl,--out-implib,libimpcdll.a mycdll.def cdll.o
dllinit.o

produces a dll with these symbols:

     Export  Ordinal     Hint        Function                Entry Point
     ------  ----------  ----------  ----------------------  -----------
     [C  ]   1 (0x0001)  0 (0x0000)  dll_global_int_var      0x00002000
     [C  ]   1 (0x0001)  2 (0x0002)  dll_double_square       0x00002000
     [C  ]   2 (0x0002)  1 (0x0001)  dll_get_global_int_var  0x00001094
     [O  ]   3 (0x0003)         N/A  N/A                     0x00001048
     [C  ]   4 (0x0004)  3 (0x0003)  dll_set_global_int_var  0x0000105C
     [C  ]   5 (0x0005)  4 (0x0004)  dll_float_square        0x00001084
     [O  ]   6 (0x0006)         N/A  N/A                     0x00001074


Note two symbols at same entry point, two functions with noname.

I am able to link against this dll, but of course the test programme
crashes.


This occurs when using
only the def file to mark symbols for export and when using
__declspec(dllexport) in code +  a user-supplied .def.

Using dllwrap:
dllwrap --def mycdll.def --implib libimpcdll.a  -o cdll.dll cdll.o \
    dllinit.o

Everything works:

     Import  Ordinal     Hint        Function                Entry Point
     ------  ----------  ----------  ----------------------  -----------

     Export  Ordinal     Hint        Function                Entry Point
     ------  ----------  ----------  ----------------------  -----------
     [C  ]   4 (0x0004)  0 (0x0000)  dll_double_square       0x0000105C
     [C  ]   6 (0x0006)  1 (0x0001)  dll_float_square        0x00001074
     [C  ]   5 (0x0005)  2 (0x0002)  dll_get_global_int_var  0x00001094
     [C  ]   1 (0x0001)  3 (0x0003)  dll_global_int_var      0x00002000
     [C  ]   3 (0x0003)  4 (0x0004)  dll_set_global_int_var  0x00001084
     [O  ]   2 (0x0002)         N/A  N/A                     0x00001048

and I can call function 2 using its name in the import lib  or
explicitly, eg
    if (hLibrary != NULL) {
        Func2 = (lpFuncInt) GetProcAddress(hLibrary,
MAKEINTRESOURCE(2));

    }


Danny



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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