www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - direct3d9 lib frustrations

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

i'd first like to thank Ilya Minkov for all the help she (he?) has given =
me through email :)

attached is a simple program that i'm trying to write.  i'm using the =
d3d9 header file from mr. tomino's page =
(http://hp.vector.co.jp/authors/VA031566/d_direct3d9/).

here's the problem.  these headers load the d3d9.dll as a dynamic lib =
and load the functions out of it.  this has two problems.  one, it's =
kind of awkward, and forgetting to load a function results in an access =
violation.  i'd like to be able to just directly use the directx =
libraries.  two, it limits me to using basic d3d functionality, and i =
can't use any of the cool stuff like the HLSL compiler in the d3d =
extensions library, which is provided only as a static lib with the DX =
SDK.

well i haven't gotten very far.  i took the original COFF d3d9.lib (i =
included it in this zipfile) and ran the microsoft LIB /CONVERT on it to =
convert it to the older style COFF, then ran it through the old coff2omf =
provided on the digitalmars FTP server.  it made an OMF lib alright =
(d3d99.lib in this archive), and it links alright, but every time i try =
to call the Direct3DCreate9() function, i get an access violation. =20

i've tried every combination of tools and linkers and i'm really getting =
frustrated.  i can't get this to work when it seems like it would be so =
simple. =20

would anyone like to take a shot at it :P

contained in the archive:

all lib files - can go in the dmd\lib folder
the win32 folder - goes in the dmd\src\phobos folder
the bat and other d files and the def file - my "project" :P
Aug 10 2004
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_000B_01C47F29.234249B0"


------=_NextPart_001_000B_01C47F29.234249B0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

oooookay forgot the attachment.
------=_NextPart_001_000B_01C47F29.234249B0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>oooookay forgot the=20
attachment.</FONT></DIV></BODY></HTML>

------=_NextPart_001_000B_01C47F29.234249B0--
Aug 10 2004
prev sibling parent reply k2 <k2_member pathlink.com> writes:
When you use .lib, change as follows:

//extern (Windows) IDirect3D9 function (UINT SDKVersion) Direct3DCreate9;
extern(Windows) export IDirect3D9 Direct3DCreate9(UINT SDKVersion);
Aug 10 2004
parent reply Mike Parker <aldacron71 yahoo.com> writes:
k2 wrote:
 When you use .lib, change as follows:
 
 //extern (Windows) IDirect3D9 function (UINT SDKVersion) Direct3DCreate9;
 extern(Windows) export IDirect3D9 Direct3DCreate9(UINT SDKVersion);
 
 

explicitly, not through an import library. His problem is with D3DX, which is a /static/ library. And to the best of my knowledge there's no way it's going to work.
Aug 11 2004
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
 //extern (Windows) IDirect3D9 function (UINT SDKVersion)


 extern(Windows) export IDirect3D9 Direct3DCreate9(UINT SDKVersion);


*bangs head on desk* of course. defining a function pointer isn't going to work :P thanks for that. unfortunately it still won't work.
 That doesn't help him in this case. The D3D dll is being loaded
 explicitly, not through an import library.

no, i'm trying to load it with an import library.
 His problem is with D3DX,
 which is a /static/ library. And to the best of my knowledge there's no
 way it's going to work.

why not?
Aug 11 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
In article <cfd6up$p1p$1 digitaldaemon.com>, Jarrett Billingsley says...
 His problem is with D3DX,
 which is a /static/ library. And to the best of my knowledge there's no
 way it's going to work.

why not?

Apparently, the static library for D3DX only works with Microsoft's compiler. I've read that the Borland users found a way to create a .lib for the Borland compiler, so I'm optimistic that something similar can be done for the Digital Mars compilers. If you want more information on the issue, read this: http://www.dsource.org/forums/viewtopic.php?t=288 jcc7
Aug 11 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
great.

i hate lib files.  i had no idea there were so many kinds and so many
differences.

i thought they were supposed to make code PORTABLE!!
Aug 11 2004
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
oh thank you k2 :)  ignore my last post about it not working.  i forgot to
change something in my bat file :P  it works now!  only problem is, now i
get a switch error on a switch.  i think it might have something to do with
using an enum as the parameter.

it WORKS!  :D
Aug 11 2004
next sibling parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Jarrett Billingsley wrote:
 oh thank you k2 :)  ignore my last post about it not working.  i forgot to
 change something in my bat file :P  it works now!  only problem is, now i
 get a switch error on a switch.  i think it might have something to do with
 using an enum as the parameter.
 
 it WORKS!  :D
 
 

Or you haven't handled the default case correctly. (You need a break or something.) Lars Ivar Igesund
Aug 11 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
that was it.  thanks.
Aug 11 2004
prev sibling parent k2 <k2_member pathlink.com> writes:
As Lars Ivar Igesund has said, a default is not in switch. 
You have to add a default break to WinProc of d3dtest.d. 
Aug 11 2004