offsetof

Heinz Traub malagana15 at yahoo.es
Thu Aug 21 12:32:57 PDT 2008


Hi,

I've been doing Direct Input code and need to port C to D. I'm trying to get the offset of a struct member (http://www.digitalmars.com/d/1.0/ctod.html#fieldoffset) but when i do this:

module dinputd;
struct DIMOUSESTATE
{
	long lX;
	long lY;
	long lZ;
	byte rgbButtons[4];
}

...
module dinputdriver;
case DIMOUSESTATE.lX.offsetof:

I get the following error:

Error: this for lX needs to be type DIMOUSESTATE not type dinputdriver.Mouse.

if i call offsetof in dinputd(the same module where DIMOUSESTATE struct is declared) i get the following error:

dinputd.d(89): Error: no property 'lX' for type 'DIMOUSESTATE'

Damn! i'm doing everything as specified by the docs. But i can't get it to work.

Can someone help me please. Thanks in advance.

Heinz


More information about the Digitalmars-d-learn mailing list