Advertisement

DirectX without compiler dependent linking

Started by January 31, 2014 08:27 PM
3 comments, last by Aldacron 10 years, 9 months ago

Is it possible to use DirectX from C without any linking of static libraries so that the user can easily re-compile generated code from a single source file with any C compiler?

Its possible to load the D3D dll dynamically, however, I don't not know why you specified C, the DX api is C++ based afaik, so I don't know how much you would be able to use with C

Advertisement

Its possible to load the D3D dll dynamically, however, I don't not know why you specified C, the DX api is C++ based afaik, so I don't know how much you would be able to use with C

I use C as a compiler back end. Anything high level with object unwinding would not be compatible with the garbage collection and calling convention in my own language.

Is it possible to use DirectX from C without any linking of static libraries so that the user can easily re-compile generated code from a single source file with any C compiler?

Yes. Assuming Direct3D, just load Direct3DCreate with LoadLibrary + GetProcAddress and away you go. This is what SDL 2 does.

Its possible to load the D3D dll dynamically, however, I don't not know why you specified C, the DX api is C++ based afaik, so I don't know how much you would be able to use with C

Direct3D is a COM-based API. COM interfaces can be used from both C and C++. The D3D headers provide macros that make using them in C somewhat more convenient than they would be otherwise.

This topic is closed to new replies.

Advertisement