diff --git a/vhook.cpp b/vhook.cpp
index e8fbbe8..2c46684 100644
--- a/vhook.cpp
+++ b/vhook.cpp
@@ -7,6 +7,7 @@ SourceHook::IHookManagerAutoGen *g_pHookManager = NULL;
 ke::Vector<DHooksManager *> g_pHooks;
 
 using namespace SourceHook;
+using namespace sp;
 
 #ifdef  WIN32
 #define OBJECT_OFFSET sizeof(void *)
@@ -14,6 +15,95 @@ using namespace SourceHook;
 #define OBJECT_OFFSET (sizeof(void *)*2)
 #endif
 
+#ifndef  WIN32
+void *GenerateThunk(ReturnType type)
+{
+	sp::MacroAssembler masm;
+	static const size_t kStackNeeded = (2) * 4; // 2 args max
+	static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8;
+
+	masm.push(ebp);
+	masm.movl(ebp, esp);
+	masm.subl(esp, kReserve);
+	if(type != ReturnType_String && type != ReturnType_Vector)
+	{
+		masm.lea(eax, Operand(ebp, 12)); // grab the incoming caller argument vector
+		masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
+		masm.movl(eax, Operand(ebp, 8)); // grab the |this|
+		masm.movl(Operand(esp, 0 * 4), eax); // set |this| as the 1st argument*/
+	}
+	else
+	{
+		masm.lea(eax, Operand(ebp, 8)); // grab the incoming caller argument vector
+		masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
+		masm.movl(eax, Operand(ebp, 12)); // grab the |this|
+		masm.movl(Operand(esp, 0 * 4), eax); // set |this| as the 1st argument*/
+	}
+	if(type == ReturnType_Float)
+	{
+		masm.call(ExternalAddress((void *)Callback_float));
+	}
+	else if(type == ReturnType_Vector)
+	{
+		masm.call(ExternalAddress((void *)Callback_vector));
+	}
+	else if(type == ReturnType_String)
+	{
+		masm.call(ExternalAddress((void *)Callback_stringt));
+	}
+	else
+	{
+		masm.call(ExternalAddress((void *)Callback));
+	}
+	masm.addl(esp, kReserve);
+	masm.pop(ebp); // restore ebp
+	masm.ret();
+
+	void *base =  g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
+	masm.emitToExecutableMemory(base);
+	return base;
+}
+#else
+// HUGE THANKS TO BAILOPAN (dvander)!
+void *GenerateThunk(ReturnType type)
+{
+	sp::MacroAssembler masm;
+	static const size_t kStackNeeded = (3 + 1) * 4; // 3 args max, 1 locals max
+	static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8;
+
+	masm.push(ebp);
+	masm.movl(ebp, esp);
+	masm.subl(esp, kReserve);
+	masm.lea(eax, Operand(esp, 3 * 4)); // ptr to 2nd var after argument space
+	masm.movl(Operand(esp, 2 * 4), eax); // set the ptr as the third argument
+	masm.lea(eax, Operand(ebp, 8)); // grab the incoming caller argument vector
+	masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
+	masm.movl(Operand(esp, 0 * 4), ecx); // set |this| as the 1st argument
+	if(type == ReturnType_Float)
+	{
+		masm.call(ExternalAddress(Callback_float));
+	}
+	else if(type == ReturnType_Vector)
+	{
+		masm.call(ExternalAddress(Callback_vector));
+	}
+	else
+	{
+		masm.call(ExternalAddress(Callback));
+	}
+	masm.movl(ecx, Operand(esp, 3*4));
+	masm.addl(esp, kReserve);
+	masm.pop(ebp); // restore ebp
+	masm.pop(edx); // grab return address in edx
+	masm.addl(esp, ecx); // remove arguments
+	masm.jmp(edx); // return to caller
+ 
+	void *base =  g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
+	masm.emitToExecutableMemory(base);
+	return base;
+}
+#endif
+
 DHooksManager::DHooksManager(HookSetup *setup, void *iface, IPluginFunction *remove_callback, IPluginFunction *plugincb, bool post)
 {
 	this->callback = MakeHandler(setup->returnType);
diff --git a/vhook.h b/vhook.h
index 4d61265..19fee5c 100644
--- a/vhook.h
+++ b/vhook.h
@@ -162,95 +162,7 @@ bool SetupHookManager(ISmmAPI *ismm);
 void CleanupHooks(IPluginContext *pContext = NULL);
 size_t GetParamTypeSize(HookParamType type);
 SourceHook::PassInfo::PassType GetParamTypePassType(HookParamType type);
-
-#ifndef  WIN32
-static void *GenerateThunk(ReturnType type)
-{
-	sp::MacroAssemblerX86 masm;
-	static const size_t kStackNeeded = (2) * 4; // 2 args max
-	static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8;
-
-	masm.push(ebp);
-	masm.movl(ebp, esp);
-	masm.subl(esp, kReserve);
-	if(type != ReturnType_String && type != ReturnType_Vector)
-	{
-		masm.lea(eax, Operand(ebp, 12)); // grab the incoming caller argument vector
-		masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
-		masm.movl(eax, Operand(ebp, 8)); // grab the |this|
-		masm.movl(Operand(esp, 0 * 4), eax); // set |this| as the 1st argument*/
-	}
-	else
-	{
-		masm.lea(eax, Operand(ebp, 8)); // grab the incoming caller argument vector
-		masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
-		masm.movl(eax, Operand(ebp, 12)); // grab the |this|
-		masm.movl(Operand(esp, 0 * 4), eax); // set |this| as the 1st argument*/
-	}
-	if(type == ReturnType_Float)
-	{
-		masm.call(ExternalAddress((void *)Callback_float));
-	}
-	else if(type == ReturnType_Vector)
-	{
-		masm.call(ExternalAddress((void *)Callback_vector));
-	}
-	else if(type == ReturnType_String)
-	{
-		masm.call(ExternalAddress((void *)Callback_stringt));
-	}
-	else
-	{
-		masm.call(ExternalAddress((void *)Callback));
-	}
-	masm.addl(esp, kReserve);
-	masm.pop(ebp); // restore ebp
-	masm.ret();
-
-	void *base =  g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
-	masm.emitToExecutableMemory(base);
-	return base;
-}
-#else
-// HUGE THANKS TO BAILOPAN (dvander)!
-static void *GenerateThunk(ReturnType type)
-{
-	sp::MacroAssemblerX86 masm;
-	static const size_t kStackNeeded = (3 + 1) * 4; // 3 args max, 1 locals max
-	static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8;
-
-	masm.push(ebp);
-	masm.movl(ebp, esp);
-	masm.subl(esp, kReserve);
-	masm.lea(eax, Operand(esp, 3 * 4)); // ptr to 2nd var after argument space
-	masm.movl(Operand(esp, 2 * 4), eax); // set the ptr as the third argument
-	masm.lea(eax, Operand(ebp, 8)); // grab the incoming caller argument vector
-	masm.movl(Operand(esp, 1 * 4), eax); // set that as the 2nd argument
-	masm.movl(Operand(esp, 0 * 4), ecx); // set |this| as the 1st argument
-	if(type == ReturnType_Float)
-	{
-		masm.call(ExternalAddress(Callback_float));
-	}
-	else if(type == ReturnType_Vector)
-	{
-		masm.call(ExternalAddress(Callback_vector));
-	}
-	else
-	{
-		masm.call(ExternalAddress(Callback));
-	}
-	masm.movl(ecx, Operand(esp, 3*4));
-	masm.addl(esp, kReserve);
-	masm.pop(ebp); // restore ebp
-	masm.pop(edx); // grab return address in edx
-	masm.addl(esp, ecx); // remove arguments
-	masm.jmp(edx); // return to caller
- 
-	void *base =  g_pSM->GetScriptingEngine()->AllocatePageMemory(masm.length());
-	masm.emitToExecutableMemory(base);
-	return base;
-}
-#endif
+void *GenerateThunk(ReturnType type);
 
 static DHooksCallback *MakeHandler(ReturnType type)
 {