flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > structure field offset |
Author |
|
afw2004 16 Aug 2005, 12:58
Does this code solve my problem? (I understand fasm macro langage poor)
Code: macro interface name { common offsetof.#name = $ name CInterfaced } struct CDocItem CUnknown interface m_advSink interface m_oleClientSite interface m_oleInPlaceSite ends |
|||
16 Aug 2005, 12:58 |
|
Tomasz Grysztar 16 Aug 2005, 13:17
What do you mean by "the beginning of CDocItem" structure? Do you mean something different than the "CDocItem.m_clientSite" value?
|
|||
16 Aug 2005, 13:17 |
|
afw2004 16 Aug 2005, 13:42
For example:
struct MyStruc field1 dd ? field2 dd ? field3 dd ? m_oleClientSite CInterfaced ends offset of "field1" in this case is 0. offset of "field2" is 4. offset of "field3" is 8. offset of m_oleClientSite is 12. But what if I write: struct MyStruct2 MyStruct m_fieldNext dd ? ends I don't know offset of n_fieldNext until I calculate size of MyStruct. I whant to obtain this offsets like "offsetof.MyStruct.m_oleClientSite". For example if I whant to write table based QueryInterface implementation I can define table of offsets like this: LABEL CMyObject_InterfaceMap dd IID_IUnknown, offsetof.CMyObject.m_unknown dd IID_IOleClientSite, offsetof.CMyObject.m_oleClientSite dd IID_IOleInPlaceSite, offsetof.CMyObject.m_oleInPlaceSite dd 0, 0 But now I have to manually calculate these offsets. And I often make mistakes, so QueryInterface returns wrong pointer ... |
|||
16 Aug 2005, 13:42 |
|
Tomasz Grysztar 16 Aug 2005, 13:46
The "struct" macro defines those offsets for you. They are just named like:
MyStruc.field1, MyStruc.field2, etc. (what I already mentioned in my previous post). |
|||
16 Aug 2005, 13:46 |
|
afw2004 16 Aug 2005, 13:53
Thanks. I didn`t know this...
|
|||
16 Aug 2005, 13:53 |
|
Tomasz Grysztar 16 Aug 2005, 14:02
It is documented in the section about structures here.
|
|||
16 Aug 2005, 14:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.