简体   繁体   中英

Using lib compiled in masm in c++

im trying to make a lib in masm32 (using radasm) for use in other projects...

the libs source code :

.386
.MODEL flat,stdcall
option casemap:none
.code
start:
PUBLIC HookProc
HookProc proc addy:DWORD

and for use in msvc :

extern "C" void* HookProc(void* ptr);
#pragma comment(lib, "TestHook.lib")

however this produces an error :

Win32Project1.obj : error LNK2019: unresolved external symbol _HookProc referenced in function _wmain

but i see in the lib there is

!<arch>
/               1368690603              0       20        `
®_HookProc@4/               1368690603              0       26        `

Why cant msvc see this proc in the lib ?? ;/ does this have something to do with the @4 ?

Edit : changed to .MODEL flat, c that got rid of @4 , but still _HookProc uresolved......

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM