Casting D3DX11Device from os_get_info into valid data type

Sammi3

Member
I wanted to cast the D3DX11Device and D3DX11Context from the map provided by os_get_info into the correct type using the correct formating. On the C++ side, I currently have my dll setup as follows:

Code:
fn_export double Init(void* dx11Device, void* dx11Context, void* windowHwnd) {

    //Cast void pointers to correct types
    g_pd3dDevice = (ID3D11Device*)dx11Device;
    g_pd3dDeviceContext = (ID3D11DeviceContext*)dx11Context;
    HWND hwnd = (HWND)windowHwnd;

}
I was under the impression that I had to cast them as the data type and not as a pointer to their datatype as I did the HWND but that doesn't seem to work, I can only cast them as a pointer to their data type. Any ideas on how I should approach this?

Kind thanks,
Sammi3.
 

Binsk

Member
No, GameMaker gives you a pointer so the data you will get in the DLL is a pointer. HWNDs are kind of special, look up their definition and you'll see what I mean.

If you don't want to use the pointer in the DLL just deference it and store the result in a variable. Other than that, I'm not sure what your question is?
 

Sammi3

Member
I solved this. All I had to do was cast the void pointers to a pointer of type ID3D11Device for the d3d11 device and ID3D11DeviceContext for the d3d11 context and use them as such.
 
Top