[BuildTools] importing a library from cplex under cygwin
Kerem Bulbul
bulbul at sabanciuniv.edu
Tue Dec 11 06:33:43 EST 2007
Hi:
First, I apologize that this is not directly related to coin-or, but I
think if there is a solution to my problem, the knowledge may exist here.
I am trying to compile a C program using the CPLEX callable library on
Windows under cygwin/gcc. The primary problem is that ILOG does only
provide a library for Visual Studio on Windows. Hence, the problem at
hand is extracting a library file from the cplex dll that can be used by
gcc.
Below is an e-mail that I sent to the cygwin mailing list that
summarizes the issue. Hope somebody has some helpful pointers for me.
Thanks.
Kerem
----------------------------------------------------------
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. at 48)
659 293 00129814 _CPXaddrows. at 48
660 294 00129808 _CPXaddrows at 48
.....
As far as I understand, the def file should contain the following:
EXPORTS
...
CPXaddrows
CPXaddrows.= _CPXaddrows. at 48
_CPXaddrows. 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. 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.
----------------------------------------------
More information about the BuildTools
mailing list