I'm trying to make a VisualStudio 2010 C program call a fastcall convention assembly routine.
This is the declaration in the C code:
extern boolean _fastcall InNonSuspendableCriticalRegion(DWORD);
This is the declaration in the assembly code:
public @InNonSuspendableCriticalRegion@4
@InNonSuspendableCriticalRegion@4 proc near ; fastcall
<code>
@InNonSuspendableCriticalRegion@4 endp
I get the following linker error:
Assembling: C:\DMS\Domains\PARLANSE\Tools\RunTimeSystem\Source\PARLANSE0.asm
1>RuntimeSupport.obj : error LNK2001: unresolved external symbol @InNonSuspendableCriticalRegion@4
I'm sure I'm doing something silly wrong, but I can't see it.
The MS documentation is pretty hard to figure out since it is so vague. I recall in the mists of the past that the assembler does some name mangling, too, so I'm not sure how the names I'm providing are getting mangled, if they are.
This is the most explicit reference on how do it, and I think I'm following it exactly; it says,
13. FASTCALL Caller and Callee Summary
The following sample illustrates the code generated in the calling function and in the called function to support __fastcall, the fastcall calling convention:
int __fastcall FastFunc( int a, int b );
calling function called function
-------------------------------------------
mov edx, b @FastFunc@8 PROC NEAR
mov ecx, a .
call @FastFunc@8 .
. .
. RET 8
. @FastFunc@8 ENDP
Any clues?
Thanks...
Try running dumpbin on both object files to dump the symbol table. That should show both the emitted and the referencing function name. That's usually helpful in diagnosing these kinds of problems.