|
-
November 14th, 2010, 04:10 PM
#1
Unresolved external called in c++, written in assembly
Hi all,
I'm a complete beginner to assembly and am trying to bootstrap my understanding by writing some assembly and linking it into a c++ program. So far I have a very simple project in VS Express 2008:
Code:
#include <tchar.h>
extern "C"
{
void clear();
}
int _tmain(int argc, _TCHAR* argv[])
{
clear();
};
I also have an assembly file:
Code:
.586
.MODEL FLAT, C
.CODE
clear PROC
xor eax, eax
xor ebx, ebx
ret
clear ENDP
END
which defines the clear() function (poached from an online example). The assembly is successfully compiled into an obj file. However when linking I get an unresolved external:
error LNK2019: unresolved external symbol _clear referenced in function _wmain
Am I missing some "export like" command, or is the clear() function getting mangled somehow, or something else? (NB I tried chaning the definition to _clear PROC but that didn't work either)
Thanks,
Andy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|