Question: Calling Convention for External Assembly Code

I've looked at Alec Mihailov's interesting web page describing how to use the Microsoft assembler (MASM) to create a DLL that can be called by a Maple procedure. I'm attempting to rewrite the code using the GNU assembler (as) and have a few questions. Page 331, section 6.2 of the Maple 10 Advanced Programming Guide states that, to create a DLL, "the external library functions must be compiled by using the _stdcall calling convention, which is the default under UNIX but must be specified when using most Windows compilers." This leaves me somewhat confused. My limited understanding is that the stdcall calling convention has two effects:
  1. the arguments are pushed onto the stack in reverse order;
  2. the callee (the assembly procedure) is responsible for cleaning the stack.
As I understand it, (1) is the standard for C in the UNIX world, but (2) is not. That is, in UNIX C, the caller is responsible for cleaning the stack. Does my assembly code written for as have to clean the stack before returning? If so, how does Alec's code accomplish this? That is, does the STDCALL directive in the function header tell MASM to insert the code that pops the stack? Is there an equivalent directive for as?
Please Wait...