am using CodeBlocks and am trying to make a hook dll so inside
DllMain
#include "main.h"
#include "Asm.h"
#include <stdio.h>
using namespace std;
static HINSTANCE WINAPI Mysnprintf(char* str, int len, const char* format, ...);
static void InitDll(){
Originalsnprintf = (snprintfFn)GetProcAddress(GetModuleHandleA("msvcr90.dll"), "_snprintf");
Asm code;
code.JMP((int)Mysnprintf); // where JMP = Asm& JMP(int address){...}
}
I have no clue what’s wrong since if I did the same with Microsoft Visual C++ it will work with no errors!!!
The linker tells you the function is undefined, and it’s right. You have not written a definition for your function. You’ve merely declared it.
Put some curly braces after the function and tell your compiler what you want that function to do: