www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking with d3d11.dll/lib

reply John Burton <john.burton jbmail.com> writes:
I'm trying to use the d3d11 bindings in
http://www.dsource.org/projects/bindings/wiki/DirectX to call
direct3d11 functions from my D program.

I've managed to get the code to compiler but when it links I get
this error -

Error 42 Symbol Undefined _D3D11CreateDeviceAndSwapChain 48

I have copied the D3D11.lib from the D3D SDK into my project and
then run "COFFIMPLIB d3d11.lib -f" to convert it and included the
library in my project settings.

Is there something else I need to do to make this link? Any help
appreciated.
Feb 23 2012
next sibling parent James Miller <james aatch.net> writes:
On 24 February 2012 12:03, John Burton <john.burton jbmail.com> wrote:
 I'm trying to use the d3d11 bindings in
 http://www.dsource.org/projects/bindings/wiki/DirectX to call
 direct3d11 functions from my D program.

 I've managed to get the code to compiler but when it links I get
 this error -

 Error 42 Symbol Undefined _D3D11CreateDeviceAndSwapChain 48

 I have copied the D3D11.lib from the D3D SDK into my project and
 then run "COFFIMPLIB d3d11.lib -f" to convert it and included the
 library in my project settings.

 Is there something else I need to do to make this link? Any help
 appreciated.

From another thread:

Adam D. Ruppe:
 On Wednesday, 22 February 2012 at 17:02:01 UTC, miazo wrote:
 Error 42: Symbol Undefined _mysql_init 4
 libmysql.dll with implib utility.

I think the /s switch is needed on that one when doing the mysql libraries on implib. /s changes what's done with the _ in the front. I've done this before but don't remember exactly what I did though.

The documentation for the mars implib is here: http://www.digitalmars.com/ctg/implib.html and has this: /s[ystem] - Prepend '_' to exported internal names. Used to create import library from Windows NT system DLLs (for example, kernel32.dll). Note that this switch is not available via the ID I hope that helps, I don't actually do any windows programming so I can't test this at all -- James Miller
Feb 23 2012
prev sibling next sibling parent Sean Cavanaugh <WorksOnMyMachine gmail.com> writes:
On 2/23/2012 5:03 PM, John Burton wrote:
 I'm trying to use the d3d11 bindings in
 http://www.dsource.org/projects/bindings/wiki/DirectX to call
 direct3d11 functions from my D program.

 I've managed to get the code to compiler but when it links I get
 this error -

 Error 42 Symbol Undefined _D3D11CreateDeviceAndSwapChain 48

 I have copied the D3D11.lib from the D3D SDK into my project and
 then run "COFFIMPLIB d3d11.lib -f" to convert it and included the
 library in my project settings.

 Is there something else I need to do to make this link? Any help
 appreciated.

Its been quite a while since I've had time to work on my side project (which is what prompted the d3d11 module to get written). I can look into this later when I get home, as well as strip down my test app and publish it somewhere. The app is pretty simple - it creates a window, a d3d11 device, a vertex and pixel shader, a vertex and index buffer, and draws a triangle. It would be more but I had been working on a stripped down version of the an ATL/WTL like wrapper for D in the meantime, in order to handle HWND objects and generate message maps with mixins.
Feb 23 2012
prev sibling parent reply Sean Cavanaugh <WorksOnMyMachine gmail.com> writes:
On 2/23/2012 5:03 PM, John Burton wrote:
 I'm trying to use the d3d11 bindings in
 http://www.dsource.org/projects/bindings/wiki/DirectX to call
 direct3d11 functions from my D program.

 I've managed to get the code to compiler but when it links I get
 this error -

 Error 42 Symbol Undefined _D3D11CreateDeviceAndSwapChain 48

 I have copied the D3D11.lib from the D3D SDK into my project and
 then run "COFFIMPLIB d3d11.lib -f" to convert it and included the
 library in my project settings.

 Is there something else I need to do to make this link? Any help
 appreciated.

I modified my test app to use D3D11CreateDeviceAndSwapChain instead of D3D11CreateDevice and it links and runs against either function. The only trouble I had was when I went out of my way to delete the import libraries (d3d11.lib) in order to see what the link error looks like. I am currently using dmd2 2.057 and building my project with Visual Studio + VisualD plugin (0.30).
Feb 24 2012
parent John Burton <john.burton jbmail.com> writes:
Thank you for checking. I'm guessing that the most likely problem
then is that either my d3d11.lib file is broken, or the build is
not finding it somehow... I'll check later.

Thank you for confiruming it basically works :)
Feb 24 2012