Access class fields from asm

Carl Volhard CarlVolhard at web.de
Fri Jun 22 05:19:35 PDT 2007


How can i access non-static class fields?
The Code in the D-Specification doesn't work for me.
I've tried:

public class FooBar {
	public int b = 8;
}

FooBar foo = new FooBar();
FooBar *bar = &foo;
asm{
	mov EBX, [bar];
	mov EAX, FooBar.b[EBX]; 	//<- Line 65
}

and got following compile errors:


...Examples.d(65): Error: 'this' is only allowed in non-static member ...Examples.d(65): Error: this for b needs to be type FooBar not type int
...Examples.d(65): bad type/size of operands 'this.b'


More information about the Digitalmars-d-learn mailing list