In my Visual Studio 2010 there are 2 projects. One is a static lib (mhook 2.3 if someone asks) and the other is a DLL. Both are set to compile as /MT.
mhook project has two functions in its mhook.h:
BOOL Mhook_SetHook(PVOID *ppSystemFunction, PVOID pHookFunction);
BOOL Mhook_Unhook(PVOID *ppHookedFunction);
the dll project references the mhook project and uses both Mhook_SetHook and Mhook_Unhook. Same mhook.h is used. When I compile the dll project, I get the following error:
1>hookdll.obj : error LNK2001: unresolved external symbol _Mhook_Unhook
Note, that the linked successfully found the Mhook_SetHook. If I comment out the use of Mhook_Unhook, the program compiles successfully.
Dumpbin suggests that both symbols are present in the static library:
>dumpbin /symbols mhook-test.lib|find "Mhook"
015 00000000 SECT4 notype () External | ?Mhook_SetHook@@YAHPAPAXPAX@Z (i
nt __cdecl Mhook_SetHook(void * *,void *))
122 00000000 SECT3B notype () External | ?Mhook_Unhook@@YAHPAPAX@Z (int _
_cdecl Mhook_Unhook(void * *))
>
I am lost and confused, please help.