On Friday, 27 May 2016 at 09:51:56 UTC, rikki cattermole wrote:
Me and p0nce solved this on IRC.

struct Foo {
  int x;

  void foobar() {
    asm {
      mov EAX, this;
      inc [EAX+Foo.x.offsetof];
    }
  }
}

void main() {
  import std.stdio;

  Foo foo = Foo(8);
  foo.foobar;

  writeln(foo.x);
}

You have to reference the field via a register.

This is good progress. Using the assembler doesn't have many documentation examples of how to do things, guess the x[ESP] example was totally useless on the iasm page.

Reply via email to