dlltool and def files with dots and aliasing

Kerem Bulbul bulbul@sabanciuniv.edu
Tue Dec 11 09:57:00 GMT 2007


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.@48)
        659  293 00129814 _CPXaddrows.@48
        660  294 00129808 _CPXaddrows@48
.....

As far as I understand, the def file should contain the following:
EXPORTS
...
CPXaddrows
CPXaddrows.= _CPXaddrows.@48
 _CPXaddrows.@48
 _CPXaddrows@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.@48
 _CPXaddrows@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/



More information about the Cygwin mailing list