使用在c++中编译的库
Using lib compiled in masm in c++
我试图在masm32(使用radasm)中制作一个库,用于其他项目…
库源代码:
.386
.MODEL flat,stdcall
option casemap:none
.code
start:
PUBLIC HookProc
HookProc proc addy:DWORD
和用于MSVC:
extern "C" void* HookProc(void* ptr);
#pragma comment(lib, "TestHook.lib")
但是这会产生一个错误:
Win32Project1。在函数_wmain中引用了未解析的外部符号_HookProc
但是我看到库中有
!<arch>
/ 1368690603 0 20 `
®_HookProc@4/ 1368690603 0 26 `
为什么msvc不能在lib中看到这个进程??;/这和@4
有关系吗?
编辑:改为.MODEL flat, c
,摆脱了@4,但仍然_HookProc未解决......
CPP:
extern "C" int GetValue(void);
int main(int argc, char*arg[])
{
char *p = "test";
int v = GetValue();
return 0;
}
ASM:
.486
.model flat, C
option casemap :none
.code
GetValue PROC
mov eax, 1234
ret
GetValue ENDP
END