Skip to content

Commit

Permalink
Document better how to access fields of the interposed class.
Browse files Browse the repository at this point in the history
  • Loading branch information
angavrilov committed Jun 10, 2014
1 parent 0be30b8 commit 08b4279
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/include/VTableInterpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
...
}
};
Expand Down

0 comments on commit 08b4279

Please sign in to comment.