WindowsAPI Binding - Linker Errors

Mike Parker aldacron at gmail.com
Mon Jun 13 20:01:12 PDT 2011


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.


More information about the Digitalmars-d-learn mailing list