diff --git a/data/out.cpp b/data/out.cpp index 212356b..e305bdc 100644 --- a/data/out.cpp +++ b/data/out.cpp @@ -3,9 +3,9 @@ // Thunks template struct __Thunk { - template <__Function *func> + template <__Function *const *func> static Ret call(Args... args) { - return func->get_thunk_target()(std::forward(args)...); + return (*func)->get_thunk_target()(std::forward(args)...); } }; diff --git a/data/out.h b/data/out.h index b5c8c52..afb8eb5 100644 --- a/data/out.h +++ b/data/out.h @@ -27,8 +27,7 @@ class __VirtualFunctionInfo { } T *const addr; void *const parent; - template - friend class __Function; + friend class __Function>; }; // Thunks @@ -171,6 +170,7 @@ T *dup_vtable(T *vtable) { new_vtable += RTTI_SIZE; return (T *) new_vtable; } +#undef RTTI_SIZE // Forward Declarations {{ forwardDeclarations }} diff --git a/src/method.ts b/src/method.ts index 2657daf..4419996 100644 --- a/src/method.ts +++ b/src/method.ts @@ -31,7 +31,7 @@ export class Method { return `${INDENT}${this.getWrapperType()}::ptr_type ${this.shortName};\n`; } getWrapperType() { - return `decltype(${this.getName()})`; + return `std::remove_pointer_t`; } // Overwrite Helper @@ -45,9 +45,9 @@ export class Method { } const signature = this.returnType.trim() + this.args.trim(); const type = `${INTERNAL}Function<${signature}>`; - out += `${type} ${this.getName()}`; + out += `${type} *const ${this.getName()}`; if (code) { - out += `(${JSON.stringify(this.getName('::'))}, `; + out += ` = new ${type}(${JSON.stringify(this.getName('::'))}, `; if (isVirtual) { const parentMethod = parentSelf ? `(void *) ${this.#getVirtualCall(parentSelf)}` : 'nullptr'; out += `&${this.#getVirtualCall()}, ${parentMethod}`; diff --git a/src/struct.ts b/src/struct.ts index 528ebe4..7b5e5b8 100644 --- a/src/struct.ts +++ b/src/struct.ts @@ -144,7 +144,7 @@ export class Struct { if (isVirtual) { call += `this->vtable->${method.shortName}`; } else { - call += `${method.getName()}.get()`; + call += `${method.getName()}->get()`; } call += '('; if (!method.isStatic) {