www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D does not like certain libraries

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
in particular, the directx 9 libraries.  if i try to link them into my
project, optlink whines that they are not valid libraries.

i found a fantastic up-to-date d3d9 D module on a japanese website
(http://hp.vector.co.jp/authors/VA031566/d_direct3d9/).  unfortunately, it's
in.. japanese.  so they guy might explain why you can't use these libraries
directly, but i wouldn't know.  instead, his module loads the directx DLL
and gets the process addresses.  which works, but isn't very elegant, and
it's a pain to load all the functions before i use them.

that site links to a DX8 conversion project by Burton Radons.  but it's DX8
and i want DX9 ;)

as an example i've attached quartz.lib, one of the libraries that doesn't
work.  try linking it into a project and you'll see what i mean.

does anyone have ANY idea why these libraries don't want to link?


begin 666 quartz.lib
M(3QA<F-H/ HO("  ("  ("  ("  ("  ,3 S.#DY,S(P-B  ("  ("  ("  
M("  ,"  ("  (" R.38 ("  ("  8 H````+```"V ``!0(```8X```(: ``

M7U%505)46 !?7TY53$Q?24U03U)47T1%4T-225!43U(`?U%505)46E].54Q,
M7U1(54Y+7T1!5$$`7T%M<$9A8W1O<E1O1$) - !?7VEM<%]?06UP1F%C=&]R


M,3(`7T%-1V5T17)R;W)497AT5T Q, !?7VEM<%]?04U'971%<G)O<E1E>'17


M``#Z!P``"P````8`!P`$``4``0`"``8`!P`$``4``P!?04U'971%<G)O<E1E

M1$)4;T%M<$9A8W1O<D T`%]?24U03U)47T1%4T-225!43U)?455!4E1:`%]?
M3E5,3%])35!/4E1?1$530U))4%1/4 !?7VEM<%]?04U'971%<G)O<E1E>'1!

M<E1O1$) - !?7VEM<%]?1$)4;T%M<$9A8W1O<D T`']154%25%I?3E5,3%]4


M+F1E8G5G)%,``````````$$```",````````````````````0 `00BYI9&%T
M820R```````````4````S0```.$``````````P```$ `,, N:61A=&$D- ``

M05)46BYD;&PH`!,0!P````,`````````!P```/HC$DUI8W)O<V]F=" H4BD 


M``````````(````"`"YI9&%T820R0 ``P (```!H`"YI9&%T820V``````,`

M```````````````"```````X```````````````"`% ```!?7TE-4$]25%]$



MN0````(````````!+F1E8G5G)%,``````````$$```!D````````````````
M````0 `00BYI9&%T820S```````````4````I0```````````````````$ `
M,, "````$0`)```````*455!4E1:+F1L;" `$Q '`````P`````````'````
M^B,236EC<F]S;V9T("A2*2!,24Y+````````````````````````````0&-O
M;7 N:63Z(QD`__\```,```````0`````````` ````(`'0```%]?3E5,3%])
M35!/4E1?1$530U))4%1/4 !154%25%HN9&QL+R  ("  ,3 S.#DY,S(P-B  
M("  ("  ("  ("  ,"  ("  (" R-S< ("  ("  8 I,`0,`-L?M/=4````"
M`````````2YD96)U9R13``````````!!````C ```````````````````$ `




M```````"````` `<````?U%505)46E].54Q,7U1(54Y+7T1!5$$`"E%505)4

M("  ("  ("! " ``__\``$P!-L?M/1\```````P`7T%-1V5T17)R;W)497AT
M04 Q, !154%25%HN9&QL``I154%25%HN9&QL+R  ("  ,3 S.#DY,S(P-B  
M("  ("  ("  ("  ,"  ("  (" U,2  ("  ("  8 H``/__``!,`3;'[3T?
M`````0`,`%]!34=E=$5R<F]R5&5X=%= ,3(`455!4E1:+F1L; `*455!4E1:





` end
Jul 16 2004
next sibling parent reply Ilya Minkov <minkov cs.tum.edu> writes:
Jarrett Billingsley schrieb:

 in particular, the directx 9 libraries.  if i try to link them into my
 project, optlink whines that they are not valid libraries.
Probably they are not valid. The file you have attached looks suspiciously like a COFF library, like from MS or MinGW, while DigitalMars uses OMF format, like OpenWatcom. Even among compilers with the same format, always use the libraries generated by the corresponding compiler, because symbols or sections can be named differently. You have following choices: - since the library is a simple stub for a DLL, you can generate one from the DLL using DigitalMars implib. - otherwise you could try using the multi-format linker from Christof Meerwald (http://cmeerw.org/prog/owtools/) -eye
Jul 16 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
In article <cd981s$gci$1 digitaldaemon.com>, Ilya Minkov says...
Jarrett Billingsley schrieb:

 in particular, the directx 9 libraries.  if i try to link them into my
 project, optlink whines that they are not valid libraries.
Probably they are not valid. The file you have attached looks suspiciously like a COFF library, like from MS or MinGW, while DigitalMars uses OMF format, like OpenWatcom. Even among compilers with the same format, always use the libraries generated by the corresponding compiler, because symbols or sections can be named differently. You have following choices: - since the library is a simple stub for a DLL, you can generate one from the DLL using DigitalMars implib. - otherwise you could try using the multi-format linker from Christof Meerwald (http://cmeerw.org/prog/owtools/) -eye
I think what Ilya has written is correct. There was a similar discussion on dsource regarding OpenGL .lib files: http://www.dsource.org/forums/viewtopic.php?t=221 jcc7
Jul 16 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
thank you Ilya and JC :) didn't know that the two were actually different
formats!  you would think that a .lib would be very portable and that there
would only be one kind but i guess not.
Jul 16 2004
prev sibling next sibling parent reply pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cd93p7$ehh$1 digitaldaemon.com>, Jarrett Billingsley says...
does anyone have ANY idea why these libraries don't want to link?
*Any* ideas? Well I've had issues linking against MS-compiled libraries as well. This is the reason why the Alpha for DSP features a C apache module (mod_dsp.c) instead of a D one. I've always thought it was some binary incompatibility between micrsoft's .lib format and Digitalmars' format, but I'm not sure on this. I just accepted the two as incompatible and moved on. - Pragma
Jul 16 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"pragma" <EricAnderton at yahoo dot compragma_member pathlink.com> escribió
en el
mensaje news:cd98tp$gqa$1 digitaldaemon.com
| *Any* ideas?
|
| Well I've had issues linking against MS-compiled libraries as well.  This
is the
| reason why the Alpha for DSP features a C apache module (mod_dsp.c)
instead of a
| D one.
|
| I've always thought it was some binary incompatibility between micrsoft's
.lib
| format and Digitalmars' format, but I'm not sure on this. I just accepted
the
| two as incompatible and moved on.
|
| - Pragma

You can convert coff to omf. First, you convert the coff lib from version 6
to version 5 (lib /convert or link /convert, I'm not sure) with Microsoft
tools. Then you use DigitalMars' coff2omf and there you have it.

-----------------------
Carlos Santander Bernal
Jul 17 2004
next sibling parent pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cdcsv9$1uvl$1 digitaldaemon.com>, Carlos Santander B. says...
"pragma" <EricAnderton at yahoo dot compragma_member pathlink.com> escribió
en el
mensaje news:cd98tp$gqa$1 digitaldaemon.com
| *Any* ideas?
|
| Well I've had issues linking against MS-compiled libraries as well.  This
is the
| reason why the Alpha for DSP features a C apache module (mod_dsp.c)
instead of a
| D one.
|
| I've always thought it was some binary incompatibility between micrsoft's
.lib
| format and Digitalmars' format, but I'm not sure on this. I just accepted
the
| two as incompatible and moved on.
|
| - Pragma

You can convert coff to omf. First, you convert the coff lib from version 6
to version 5 (lib /convert or link /convert, I'm not sure) with Microsoft
tools. Then you use DigitalMars' coff2omf and there you have it.
Much obliged, Carlos! When I get a chance, I'll have to check this out. - Pragma
Jul 18 2004
prev sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
indeed, thank you :)  i figured that there should be some way to convert
.libs.  after all, they serve the same purpose.
Jul 20 2004
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
aaagh :P

it doesn't work.  i used the DLL to generate a .lib file, and linked it, and
it worked fine.  but when i run it i get an access violation any time i try
to access ANY imported function.

not to mention there are a few directx libs that do not have any DLL
counterpart (like d3dx).  in which case i am TOTALLY stuck.

i read on that OpenGL thread that JC posted that i might need to make a .def
file with all the function names.. but who says that will work if the
conversion from DLL>lib didn't?  especially since the directx functions
don't have any decoration, and i don't see why i'd need a .def explaining
the conversions (like _func 4=func) ...
Jul 17 2004
parent reply Mike Parker <aldacron71 yahoo.com> writes:
Jarrett Billingsley wrote:
 aaagh :P
 
 it doesn't work.  i used the DLL to generate a .lib file, and linked it, and
 it worked fine.  but when i run it i get an access violation any time i try
 to access ANY imported function.
 
 not to mention there are a few directx libs that do not have any DLL
 counterpart (like d3dx).  in which case i am TOTALLY stuck.
 
 i read on that OpenGL thread that JC posted that i might need to make a .def
 file with all the function names.. but who says that will work if the
 conversion from DLL>lib didn't?  especially since the directx functions
 don't have any decoration, and i don't see why i'd need a .def explaining
 the conversions (like _func 4=func) ...
 
 
D3DX aside, the only purpose to link to the dx libs is to get at the *Create functions. This can be avoided altogether via LoadLibrary or, preferably, obtaining the desired interfaces through the CoCreateInstance function. If you aren't familiar with COM, the three functions you will need are CoInitialize (or CoInitializeEx), CoCreateInstance, and CoUninitialize. This is the *only* way to use DirectMusic as there is no DirectMusic lib. If you've defined all of the GUIDs and interfaces you need then you should have no troubles with this approach.
Jul 17 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
sorry, i was away for a few days :P

thanks for the response!  i've used those before (in my C++ DX project) and
i didn't know they existed in D.  i shall be looking into that :)
Jul 20 2004