Sign in to follow this  
Dawoodoz

DirectX without compiler dependent linking

Recommended Posts

Dawoodoz    461

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?

Share this post


Link to post
Share on other sites
cgrant    1825

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

Share this post


Link to post
Share on other sites
Dawoodoz    461

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.

Share this post


Link to post
Share on other sites
Aldacron    4544

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

Share this post


Link to post
Share on other sites
Aldacron    4544

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this