www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - implib - what it produces?

reply Thorn <th inbox.ru> writes:
Hello, guys!
I program on D and start using DDBI. I've compiled library but I cannot link my
test project: it complains about missing functions (I linked with odbc32.lib -
very old library from digitalmars).
After this I tried to create my own import library thru "implib
\windows\system32\odbc32.dll", but I've got strange library - instead of smth
like "_DBConnect 20" implib broduces clear names like
"DBConnect". Of course linker couldn't find functions. :(
Please, may be somebody can explain what a benefit to use implib and second:
how to link my ODBC programs?

Thanks!
Nov 20 2006
parent reply jcc7 <technocrat7 gmail.com> writes:
== Quote from Thorn (th inbox.ru)'s article
 Hello, guys!
 I program on D and start using DDBI. I've compiled library but I
 cannot link my test project: it complains about missing functions (I
 linked with odbc32.lib - very old library from digitalmars).
 After this I tried to create my own import library thru "implib
 \windows\system32\odbc32.dll", but I've got strange library -
 instead of smth like "_DBConnect 20" implib broduces clear names
 like "DBConnect". Of course linker couldn't find functions. :(
 Please, may be somebody can explain what a benefit to use implib and
 second: how to link my ODBC programs?
 Thanks!

I like to use implib like this: implib odbc32.lib odbc32.def (where I provide a .def file) The trick, of course, would be to find a .def file. There are some available in the binding project at dsource, such as: http://www.dsource.org/projects/bindings/browser/trunk/def/odbc32.def But that might not have all of the definitions. You could also try using linkdef: http://www.dprogramming.com/linkdef.php Finally, I've attached a .def file that has many more definitions than the one in the bindings project. I expect it'll will work for you, but I can't test it for you (obviously). I think that Walter has made a tool available that helps with turning a .dll into a DMD-compatible .lib, but I don't recall the details. (This is a common topic, so I guess someone should write a wiki page about it. Maybe I'll do that eventually.)
Nov 21 2006
next sibling parent Bradley Smith <digitalmars-com baysmith.com> writes:
See http://www.digitalmars.com/ctg/implib.html


jcc7 wrote:
 == Quote from Thorn (th inbox.ru)'s article
 Hello, guys!
 I program on D and start using DDBI. I've compiled library but I
 cannot link my test project: it complains about missing functions (I
 linked with odbc32.lib - very old library from digitalmars).
 After this I tried to create my own import library thru "implib
 \windows\system32\odbc32.dll", but I've got strange library -
 instead of smth like "_DBConnect 20" implib broduces clear names
 like "DBConnect". Of course linker couldn't find functions. :(
 Please, may be somebody can explain what a benefit to use implib and
 second: how to link my ODBC programs?
 Thanks!

I like to use implib like this: implib odbc32.lib odbc32.def (where I provide a .def file) The trick, of course, would be to find a .def file. There are some available in the binding project at dsource, such as: http://www.dsource.org/projects/bindings/browser/trunk/def/odbc32.def But that might not have all of the definitions. You could also try using linkdef: http://www.dprogramming.com/linkdef.php Finally, I've attached a .def file that has many more definitions than the one in the bindings project. I expect it'll will work for you, but I can't test it for you (obviously). I think that Walter has made a tool available that helps with turning a .dll into a DMD-compatible .lib, but I don't recall the details.

Nov 21 2006
prev sibling parent "Vincent Thorn" <th inbox.ru> writes:
Hey, jcc!
Thank you VERY much for your help!
I tried your stuff at home and now we have two solutions:

1. Take prepared odbc32.def and create by implib "import library" file.
2. Take M$'s odbc32.lib from VS distribution and convert it by  
"coffimplib" to lib file, acceptable by DMD linker.

Anyway, it's VERY IMPORTANT to keep in D distribution fresh and usable  
files. It's very annoying to dig Internet
instead of real working.

 I think that Walter has made a tool available that helps with turning a  
 .dll into a DMD-compatible .lib, but I don't recall the details.

Theoretically it can be made by pointed "linkdef" utility, but it returns only USED symbols, not all. OK, thanks again, jcc! Will wait for Walter attention...
Nov 23 2006