delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/07/27/17:55:54

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <20000727215333.16929.qmail@hotmail.com>
X-Originating-IP: [203.97.2.246]
From: "Danny Smith" <danny_r_smith AT hotmail DOT com>
To: <cygwin AT sources DOT redhat DOT com>
Subject: ld -shared (binutils-20000722-1) does not support NONAME in .def
Date: Fri, 28 Jul 2000 09:51:01 +1200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600

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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019