Re: ver 4.0 calling convention information ?
- Posted by mattlewis (admin) May 26, 2009
- 800 views
I need to know the following:
Is there more than one TYPE of routine_id returned from Euphoria ?
If so what creates each TYPE and when is it used ?
Are you referring to the fact that the documentation refers to the result of define_c_proc as a routine id? We really need to change that. It isn't a euphoria id at all. A better term would probably be handle, since it's completely opaque to euphoria code.
I need to know the calling conventions and who is responsible for
cleaning the stack for the following routines.
Euphoria call type routine receiving call\\ CALL_FUNC ( std or cdecl call ) ( clean stack for return ? )\\ C_FUNC ( std or cdecl call ) ( clean stack for return ? )\\ CALL ( std or cdecl call ) ( clean stack for return ? )\\
There's no stack to worry about with call_func()/call_proc(). These are basically equivalent to calling a euphoria routine normally. The backend takes care of the call stack. For interpreted code, it's an internal data structure, not the actual machine stack.
With c_func()/c_proc(), if the calling convention is stdcall, then the callee (the routine being called) is responsible for stack cleanup. For cdecl, the caller is responsible.
A call() doesn't really matter, since there are no parameters passed on the stack, there's really no difference between calling conventions, since no one needs to clean up anything.
Matt