quick.h
int Alloc( int size );
int __fastcall QuickAlloc1( int size );
int __fastcall QuickAlloc2( int size );
call.asm
.CODE
extrn Alloc:near
extrn QuickAlloc1:near
extrn @QuickAlloc2@4:near
...
call Alloc
call QuickAlloc1
call @QuickAlloc2@4
...
Linker reports
error LNK2001: unresolved external symbol _QuickAlloc1
error LNK2001: unresolved external symbol _@QuickAlloc2@4
I don't know how to tell ml to decorate the function name properly for me,
and it won't even let my do it myself because it insists on doing the
"normal" C function name mangling of prepending the _ character. Does
anyone know how to do this right? I'm using Microsoft VC++ 6.0 and Microsoft
ml.exe 6.14.8444.
Thanks,
Mark
try
extrn C Alloc: proc
extrn fastcall QuickAlloc1: proc
extrn fastcall QuickAlloc2: proc
Daniel Pfeffer.
What assembler/version do you use? I copied your code into my file, but I
get:
D:\os63\W32\C\ASM>ml -c -Cp -Zd /coff interp.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: interp.asm
interp.asm(578) : error A2008: syntax error : QuickAlloc1
interp.asm(579) : error A2008: syntax error : QuickAlloc2
Thanks,
Mark
I was using an older version of MASM. Using MASM 6.11, the following file
compiled correctly.
.386
.model flat
.code
Alloc1 proc C
ret
Alloc1 endp
@Alloc2 proc
ret
@Alloc2 endp
end
Note that there is no language defined in the .model statement, so when a
C-style procedure is desired - you must explicitly specify the language in
the 'proc' statement.
Daniel Pfeffer
FYI, using SYSCALL is the way to go here, e.g.
extrn syscall @QuickAlloc1@4:near
generates instructions to the linker to use the func name exactly as
specified and not decorate it.