summaryrefslogtreecommitdiff
path: root/library/DataDefs.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-08-17 22:40:53 +0400
committerAlexander Gavrilov2012-08-17 22:40:53 +0400
commit236ffd578b66805fa45d65df79e099d00156bfff (patch)
treecdbf17b2c1fb3c3cf5135531861ecd0c90061abe /library/DataDefs.cpp
parentbcc41c081a43a68042c4757a6569cb690098d9b8 (diff)
downloaddfhack-236ffd578b66805fa45d65df79e099d00156bfff.tar.gz
dfhack-236ffd578b66805fa45d65df79e099d00156bfff.tar.bz2
dfhack-236ffd578b66805fa45d65df79e099d00156bfff.tar.xz
Add experimental support for interposing vmethods of known classes.
The hairiest bit is the abuse of compiler-specific pointer-to-member internals in order to provide more or less transparent API.
Diffstat (limited to 'library/DataDefs.cpp')
-rw-r--r--library/DataDefs.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp
index 7f0bacc9..d6604cdb 100644
--- a/library/DataDefs.cpp
+++ b/library/DataDefs.cpp
@@ -35,6 +35,7 @@ distribution.
// must be last due to MS stupidity
#include "DataDefs.h"
#include "DataIdentity.h"
+#include "VTableInterpose.h"
#include "MiscUtils.h"
@@ -214,6 +215,13 @@ virtual_identity::virtual_identity(size_t size, TAllocateFn alloc,
{
}
+virtual_identity::~virtual_identity()
+{
+ // Remove interpose entries, so that they don't try accessing this object later
+ for (int i = interpose_list.size()-1; i >= 0; i--)
+ interpose_list[i]->remove();
+}
+
/* Vtable name to identity lookup. */
static std::map<std::string, virtual_identity*> name_lookup;