Document better how to access fields of the interposed class.

develop
Alexander Gavrilov 2014-06-10 13:10:10 +04:00
parent 0be30b807c
commit 08b4279c4d
1 changed files with 6 additions and 2 deletions

@ -42,12 +42,16 @@ namespace DFHack
struct my_hack : df::someclass {
typedef df::someclass interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, foo, (int arg)) {
// You may define additional methods here, but NOT non-static fields
DEFINE_VMETHOD_INTERPOSE(int, foo, (int arg)) {
// If needed by the code, claim the suspend lock.
// DO NOT USE THE USUAL CoreSuspender, OR IT WILL DEADLOCK!
// CoreSuspendClaimer suspend;
...
INTERPOSE_NEXT(foo)(arg) // call the original
... this->field ... // access fields of the df::someclass object
...
int orig_retval = INTERPOSE_NEXT(foo)(arg); // call the original method
...
}
};