Thread overview
implib - what it produces?
Nov 20, 2006
Thorn
Nov 21, 2006
jcc7
Nov 22, 2006
Bradley Smith
Nov 23, 2006
Vincent Thorn
November 20, 2006
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!
November 21, 2006
== 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.)
November 22, 2006
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.
> 
November 23, 2006
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...