Thread overview
WindowsAPI Binding - Linker Errors
Jun 13, 2011
Loopback
Jun 13, 2011
Nick Sabalausky
Jun 13, 2011
Nick Sabalausky
Jun 14, 2011
Mike Parker
June 13, 2011
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?
June 13, 2011
"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



June 13, 2011
"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.


June 14, 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.