Sorry about the vagueness of the thread title, I didn't want to scare anyone away...
Ok, I started learning about Linking assembly routines into visual C++ programs via the Custom Build options.
I think I've declared everything as I should, here's my main C++ source:
Code:
#include <iostream>
extern "C" _asm_main();
int main (int argc, char* argv[])
{
_asm_main();
return 0;
}
Now the .asm file, with the declaration of _asm_main:
Code:
.386
.model flat, C
.code
_asm_main PROC
mov eax, 10
ret
_asm_main ENDP
END
I'm assembling with TASM 5.0, using the Custom Build command 'C:\TASM\BIN\TASM.EXE $(InputPath)' and output 'extproc.obj' (the assembly file is called extproc.asm).
I get the infamous LNK1120 (unresolved externals). Here's the complete output, for the record:
Code:
--------------------Configuration: atest - Win32 Debug--------------------
Performing Custom Build Step on .\extproc.asm
Turbo Assembler Version 4.1 Copyright (c) 1988, 1996 Borland International
Assembling file: .\extproc.asm to extproc.OBJ
Error messages: None
Warning messages: None
Passes: 1
Remaining memory: 411k
Linking...
.\extproc.obj : warning LNK4033: converting object format from OMF to COFF
main.obj : error LNK2001: unresolved external symbol __asm_main
Debug/atest.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
atest.exe - 3 error(s), 2 warning(s)
Help greatly appreciated