Questions regarding D
Denis Koroskin
2korden at gmail.com
Thu Jan 15 00:58:30 PST 2009
On Thu, 15 Jan 2009 00:17:30 +0300, Jarrett Billingsley <jarrett.billingsley at gmail.com> wrote:
> On Wed, Jan 14, 2009 at 2:58 PM, William Newbery
> <wnewbery at hotmail.co.uk> wrote:
>
>> 4)Support for directX: Specificaly I need to be able to use d3d9,
>> d3dx9, d3d10, d3dx10 and xAudio2.
>
> It's entirely possible. D natively supports COM interfaces and the
> Windows calling convention, so it's really just a matter of porting
> the headers from C++. There are ports of DirectX 9 and possibly 8
> (though that doesn't help you..) headers already. The other small
> hurdle is linking against the DirectX DLLs - thankfully MS has put
> D3DX in a DLL of its own and you no longer have to deal with the
> static linking BS that used to be necessary. More or less it's a
> matter of just using implib (comes with DMC, I think, or DMD) on the
> DLL with the /system flag and including the .def file it generates on
> the command line when you compile/link your program.
>
> I don't think anyone's taken a shot at porting the DX10 headers, so
> you'd be on your own there.
>
DX10 headers have been ported long ago:
http://dsource.org/projects/bindings/browser/trunk/win32/directx
>> 5)Support for classes in dynamic libaries, and the ability to
>> dynamicaly load these libaries.
>
> You're on Windows, so no. Well, for the most part, no. SOs on Linux
> work perfectly. DLLs on Windows are not sufficient for what D needs
> to do proper dynamic linking. Namely, there are issues with TypeInfo
> - the runtime type information that the D runtime uses to perform all
> sorts of useful things, like throwing exceptions and sorting arrays
> and doing downcasts. What ends up happening is that the RTTI is
> duplicated in both the EXE and the DLL, and the runtime does no
> stitching up or removing of redundancy in those situations, leading
> to.. odd behavior. The GC and DLLs also have strange interactions -
> it's entirely possible to set up the GC to collect data inside the
> DLL, but unloading the DLL sometimes results in a segfault for reasons
> behind my understanding.
>
> You do have options. DDL is a project which aims to perform dynamic
> linking on Windows, and it works damn well. It also has a lot of
> useful utility functions to i.e. look up symbols and types by name in
> the dynamic library. There's also another project unrelated to D
> called EDLL which more or less does the same things that DDL does; I
> don't know if anyone has successfully used it with D.
More information about the Digitalmars-d-learn
mailing list