Convert const(GUID)* to GUID*

Jimmy Cao jcao219 at gmail.com
Sat Jun 25 13:05:22 PDT 2011


On Sat, Jun 25, 2011 at 2:48 PM, Loopback <elliott.darfink at gmail.com> wrote:

> Hello!
>
> I've recently been working with DirectInput using the win32 API Binding
> at dsource.org. This wrapper has been working perfectly fine until I
> started using GUID constants defined in win32.directx.dinput8.
>
> The directx function DirectInput8Create takes these parameters:
> HRESULT DirectInput8Create(HINSTANCE, DWORD, GUID*, void**, IUnknown);
>
> For the GUID* (3rd) parameter, I specify the IID_IDirectInput8 constant.
> This is defined in the dinput8 file as follows:
> const GUID IID_IDirectInput8A = {...};
>
> If I supply this constant to the DirectInput8Create function the
> compiler complains saying that it cannot convert const(GUID) to GUID*.
> If I instead use &IID_IDirectInput8 (as a reference) I get the
> "Cannot convert const(GUID)* to GUID*" instead. So my question is; how
> do I solve this?
>



I think you can cast the const away.
cast(GUID*)&IID_IDirectInput8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110625/9a830f4b/attachment.html>


More information about the Digitalmars-d-learn mailing list