delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/11/04:57:25

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <475E5EE3.8020502@sabanciuniv.edu>
Date: Tue, 11 Dec 2007 11:56:51 +0200
From: Kerem Bulbul <bulbul AT sabanciuniv DOT edu>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: dlltool and def files with dots and aliasing
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi:

I am trying to build an import library from a windows dll for which I do 
not have the source code. I am new to cygwin and programming on windows, 
and I understand that there are two main steps to this:
1. Extract a def file from the dll
2. Use dlltool to create the import library

The method described in the cygwin documentation

echo EXPORTS > cplex110.def
nm cplex110.dll | grep ' T _' | sed 's/.* T _//' >> foo.def

does not work in this case. I get "nm: cplex110.dll: no symbols"

So, I tried 

pexports cplex110.dll | sed 's/^_//' > cplex110.def

as described at
http://www.emmestech.com/software/cygwin/pexports-0.43/moron1.html

However, when run on this file, dlltool craps out with syntax errors. I 
was not sure what was going on, and finally I got my hands onto

dumpbin.exe /EXPORTS   

to get more info from the dll. There seem to be two issues:

1. pexports does not yield a correct def file when aliasing is used in 
the dll
2. dlltool does not like dots in the exported symbol names.

Ultimately, I think I have the following problem. Output of dumpbin:

    ordinal hint RVA      name
....
        119   76 00129808 CPXaddrows
        120   77          CPXaddrows. (forwarded to _CPXaddrows DOT  AT 48)
        659  293 00129814 _CPXaddrows DOT  AT 48
        660  294 00129808 _CPXaddrows AT 48
.....

As far as I understand, the def file should contain the following:
EXPORTS
...
CPXaddrows
CPXaddrows.= _CPXaddrows DOT  AT 48
 _CPXaddrows DOT  AT 48
 _CPXaddrows AT 48
...

Run on this file,

dlltool -d cplex110.def --dllname cplex110.lib -l libcplex.a -k

breaks with a syntax error at the first line that contains a dot. This 
syntax error is independent from the aliasing:
...
CPXaddrows
CPXaddrows.
 _CPXaddrows DOT  AT 48
 _CPXaddrows AT 48
...

does also break. When I remove all lines with a dot from the def file, 
dlltool works, and my program builds fine because it only calls 
CPXaddrows. Then, it yields a run time error after CPXaddrows is called.

Does anyone have an idea about how to fix this.

Thanks.

Kerem



--
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/

- Raw text -


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