Setting class variable from inline assembly

pmoore pmoore_member at pathlink.com
Mon May 22 12:33:57 PDT 2006


Thomas,

You are right. Now that I think about it again it would be impossible for the
compiler to know at runtime what the address of a class local variable would be
so it makes sense to be an offset.

Thanks for taking the time to point this out.


In article <1qv6k3-m9f.ln1 at birke.kuehne.cn>, Thomas Kuehne says...
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Thomas Kuehne schrieb am 2006-05-21:
>>
>> pmoore schrieb am 2006-05-20:
>>> Hi,
>>>
>>> It seems that within inline assembly I can read a class variable but I can't set
>>> it. Is this a bug or is there a good reason for this?
>
>> What you are looking for is:
>> #       void* p = this;
>> # 
>> #       asm{
>> #          mov EBX, p;
>> #          mov EAX, [EBX+myvar2];
>> #          // something productive here
>> #          mov [EBX+myvar2], EBX;
>> #       }
>
>The last line should have been:
>
>mov [EBX+myvar2], EAX;
>
>Thomas
>
>
>-----BEGIN PGP SIGNATURE-----
>
>iD8DBQFEcM/F3w+/yD4P9tIRArUYAJ92IWIxHqfnsRYg86NQvRABJhXfrACePP8P
>ElcidKuVewNvYMjXQqQoOjo=
>=nNmk
>-----END PGP SIGNATURE-----





More information about the Digitalmars-d-bugs mailing list