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.) begin 644 odbc32.def M<D`T(#T M94`T(#T 3T1"0U-E=%1R>5=A:71686QU90T*("` 7T]$0D-'9714<GE786ET M5F%L=65`,"`]($]$0D-'9714<GE786ET5F%L=64-"B` (%]0;W-T0V]M<&]N M4V5A<F-H4W1A='5S0V]D94`X(#T 4V5A<F-H4W1A='5S0V]D90T*("` 7U9A M;&ED871E17)R;W)1=65U94`X(#T M86QI9GE&:6QE1%-.5T`T(#T 3T1"0U%U86QI9GE&:6QE1%-.5PT*("` 7T]P M7U-13$%L;&]C0V]N;F5C=$`X(#T M;`T*("` 7U-13$-A;F-E;$`T(#T M;F5C=$`T(#T M17)R;W(-"B` (%]344Q%<G)O<E=`,S( /2!344Q%<G)O<E<-"B` (%]344Q% M8T1I<F5C=%<-"B` (%]344Q%>&5C1&ER96-T04`Q,B`](%-13$5X96-$:7)E M<F5E0V]N;F5C=`T*("` 7U-13$9R965%;G9`-"`](%-13$9R965%;G8-"B` M(%]344Q&<F5E4W1M=$`X(#T M=6QT0V]L<T`X(#T 4U%,3G5M4F5S=6QT0V]L<PT*("` 7U-13%!R97!A<F5` M,B`](%-13$=E=$9U;F-T:6]N<PT*("` 7U-13$=E=$EN9F]`,C` /2!344Q' M(#T M44Q'9714>7!E26YF;T$-"B` (%]344Q087)A;41A=&%`."`](%-13%!A<F%M M4V5T0V]N;F5C=$]P=&EO;D`Q,B`](%-13%-E=$-O;FYE8W1/<'1I;VX-"B` M96-T3W!T:6]N00T*("` 7U-13%-E=%-T;71/<'1I;VY`,3( /2!344Q39713 M"B` (%]344Q486)L97-`,S8 /2!344Q486)L97,-"B` (%]344Q486)L97-7 M(#T 4U%,0V]L=6UN4')I=FEL96=E<T$-"B` (%]344Q$871A4V]U<F-E<T`S M;DME>7,-"B` (%]344Q&;W)E:6=N2V5Y<U=`-3( /2!344Q&;W)E:6=N2V5Y M<U<-"B` (%]344Q&;W)E:6=N2V5Y<T%`-3( /2!344Q&;W)E:6=N2V5Y<T$- M"B` (%]344Q-;W)E4F5S=6QT<T`T(#T 4U%,36]R95)E<W5L=',-"B` (%]3 M44Q.871I=F53<6Q`,C0 /2!344Q.871I=F53<6P-"B` (%]344Q.871I=F53 M87)A;7,-"B` (%]344Q087)A;4]P=&EO;G-`,3( /2!344Q087)A;4]P=&EO M4')O8V5D=7)E0V]L=6UN<T`S-B`](%-13%!R;V-E9'5R94-O;'5M;G,-"B` M44Q39710;W-`,38 /2!344Q39710;W,-"B` (%]344Q397138W)O;&Q/<'1I M=FEL96=E<T`R."`](%-13%1A8FQE4')I=FEL96=E<PT*("` 7U-13%1A8FQE M5&%B;&50<FEV:6QE9V5S04`R."`](%-13%1A8FQE4')I=FEL96=E<T$-"B` M;65T97(-"B` (%]344Q!;&QO8TAA;F1L94`Q,B`](%-13$%L;&]C2&%N9&QE M1V5T1&5S8T9I96QD5T`R-"`](%-13$=E=$1E<V-&:65L9%<-"B` (%]344Q' M(#T 4U%,1V5T1&5S8U)E8T$-"B` (%]344Q'971$:6%G1FEE;&1`,C /2!3 M1V5T1&EA9T9I96QD5PT*("` 7U-13$=E=$1I86=&:65L9$%`,C /2!344Q' M86=296,-"B` (%]344Q'971$:6%G4F5C5T`S,B`](%-13$=E=$1I86=296-7 M4W1M=$%T=')`,C` /2!344Q'9713=&UT071T< T*("` 7U-13$=E=%-T;71! M='1R5T`R,"`](%-13$=E=%-T;71!='1R5PT*("` 7U-13$=E=%-T;71!='1R M04`R,"`](%-13$=E=%-T;71!='1R00T*("` 7U-13%-E=$-O;FYE8W1!='1R M1FEE;&1`,C` /2!344Q3971$97-C1FEE;&0-"B` (%]344Q3971$97-C1FEE M=$%T='(-"B` (%]344Q39713=&UT071T<E=`,38 /2!344Q39713=&UT071T M<E<-"B` (%]344Q39713=&UT071T<D%`,38 /2!344Q39713=&UT071T<D$- M"B` (%]344Q!;&QO8TAA;F1L95-T9$`Q,B`](%-13$%L;&]C2&%N9&QE4W1D M=')O>2`]($UP2&5A<$1E<W1R;WD-"B` (%]-<$AE87!686QI9&%T92`]($UP M8W0-"B` (%]-<$AE87!3:7IE(#T 37!(96%P4VEZ90T*("` 7TUP2&5A<%)E ` end
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