Hi,
When you compile a module with NASM and when would like to include it as a part of a larger program written in, say C, you have to communicate the calling convention somehow, unless there is some way to bypass type checking. For example, your assembly routine probably declares something like this:
global _MyFunction
_MyFunction:
; Assembly instructions here
whereas your C program could do something like this:
int MyFunction(int value); /* The prototype */
int theKeyValue = MyFunction(theSeedValue); /* A call to the external function: */
.. and then you also specify the location of the module to your linker. Now, in order for that to work, the (_)MyFunction should somehow be declared to satisfy the "int MyFunction(int)" prototype.
Can this be done in NASM?
If not, is there some way around it, such as bypassing the typechecking of the C compiler? I know that if, on Windows, you link the NASM-produced code into a DLL, there the function entries can be unqualified so that runtime linking to them can be done. But I'd prefer compile-time linking with typical, relatively small assembly modules.
Thanks for any hints!