www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - WindowsAPI Binding - Linker Errors

reply Loopback <elliott.darfink gmail.com> writes:
Hello!

I've been test programming win32 applications recently, and since the 
phobos win32 library is so limited, I decided to download and test the 
WindowsAPI Binding 
(http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the 
latest snapshot (as of this writing) I receive the following linker 
errors when I compile:

Error 42: Symbol Undefined _D5win328winerror12MAKE_HRESULTFbkkZi
(MAKE_HRESULT is undefined).

These are my imports: win32.mmsystem, win32.windef, win32.winuser, 
win32.wingdi and win32.directx.d3d9.

The problem lies within the DirectX module. If I do not import it, there 
are no errors. I've taken the d3d9.lib and d3dx9.lib from the DirectX 
SDK and used coffimplib and the linked to them, without success.

These are the libraries I am linking to: gdi32.lib, winmm.lib and d3d9.lib.

Any theories why MAKE_HRESULT is undefined? Have I forgotten to link to 
something?
Jun 13 2011
next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Loopback" <elliott.darfink gmail.com> wrote in message 
news:it4ud4$1kf5$1 digitalmars.com...
 Hello!

 I've been test programming win32 applications recently, and since the 
 phobos win32 library is so limited, I decided to download and test the 
 WindowsAPI Binding 
 (http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the 
 latest snapshot (as of this writing) I receive the following linker errors 
 when I compile:

 Error 42: Symbol Undefined _D5win328winerror12MAKE_HRESULTFbkkZi
 (MAKE_HRESULT is undefined).

 These are my imports: win32.mmsystem, win32.windef, win32.winuser, 
 win32.wingdi and win32.directx.d3d9.

 The problem lies within the DirectX module. If I do not import it, there 
 are no errors. I've taken the d3d9.lib and d3dx9.lib from the DirectX SDK 
 and used coffimplib and the linked to them, without success.

 These are the libraries I am linking to: gdi32.lib, winmm.lib and 
 d3d9.lib.

 Any theories why MAKE_HRESULT is undefined? Have I forgotten to link to 
 something?
You could maybe try Derelict: http://www.dsource.org/projects/derelict
Jun 13 2011
parent "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:it5ui1$1l75$1 digitalmars.com...
 "Loopback" <elliott.darfink gmail.com> wrote in message 
 news:it4ud4$1kf5$1 digitalmars.com...
 Hello!

 I've been test programming win32 applications recently, and since the 
 phobos win32 library is so limited, I decided to download and test the 
 WindowsAPI Binding 
 (http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the 
 latest snapshot (as of this writing) I receive the following linker 
 errors when I compile:

 Error 42: Symbol Undefined _D5win328winerror12MAKE_HRESULTFbkkZi
 (MAKE_HRESULT is undefined).

 These are my imports: win32.mmsystem, win32.windef, win32.winuser, 
 win32.wingdi and win32.directx.d3d9.

 The problem lies within the DirectX module. If I do not import it, there 
 are no errors. I've taken the d3d9.lib and d3dx9.lib from the DirectX SDK 
 and used coffimplib and the linked to them, without success.

 These are the libraries I am linking to: gdi32.lib, winmm.lib and 
 d3d9.lib.

 Any theories why MAKE_HRESULT is undefined? Have I forgotten to link to 
 something?
You could maybe try Derelict: http://www.dsource.org/projects/derelict
Sorry, I thought Derelict did DirectX. Looking at it now, I guess maybe it doesn't.
Jun 13 2011
prev sibling parent Mike Parker <aldacron gmail.com> writes:
On 6/13/2011 9:00 PM, Loopback wrote:
 Hello!

 I've been test programming win32 applications recently, and since the
 phobos win32 library is so limited, I decided to download and test the
 WindowsAPI Binding
 (http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the
 latest snapshot (as of this writing) I receive the following linker
 errors when I compile:

 Error 42: Symbol Undefined _D5win328winerror12MAKE_HRESULTFbkkZi
 (MAKE_HRESULT is undefined).

 These are my imports: win32.mmsystem, win32.windef, win32.winuser,
 win32.wingdi and win32.directx.d3d9.

 The problem lies within the DirectX module. If I do not import it, there
 are no errors. I've taken the d3d9.lib and d3dx9.lib from the DirectX
 SDK and used coffimplib and the linked to them, without success.

 These are the libraries I am linking to: gdi32.lib, winmm.lib and d3d9.lib.

 Any theories why MAKE_HRESULT is undefined? Have I forgotten to link to
 something?
Linking to win32 libs won't help you here. MAKE_HRESULT is a macro on the C-side, so no symbol exists for it in any of the win32 libs. On the D side, you can find it declared as a function in the bindings in winerror.d. In d3d9.d, it is called from the function MAKE_D3DHRESULT. So you need to make sure that winerror.d is compiled and linked into your executable.
Jun 13 2011