Jump to page: 1 2
Thread overview
D does not like certain libraries
Jul 16, 2004
Ilya Minkov
Jul 16, 2004
J C Calvarese
Jul 16, 2004
pragma
Jul 18, 2004
pragma
Jul 18, 2004
Mike Parker
July 16, 2004
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?



July 16, 2004
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
July 16, 2004
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


July 16, 2004
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
July 16, 2004
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.


July 18, 2004
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) ...


July 18, 2004
"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


July 18, 2004
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.
July 18, 2004
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


July 20, 2004
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 :)


« First   ‹ Prev
1 2