Article # 168, added by Geoworks, historical record
| first | previous | index | next | last |

Information on writing C stubs in GEOS.



The following is a list of which registers a C-stub can trash and
which it should not alter:

Trash: ax bx cx dx es
Save:  ds di si bp

Note: Be aware that C routines use ax and dx as return values (ax for
word-sized return values and axdx for dword-sized).


As for the size of the parameters on the stack, they must all be a
multiple of word size. For example, if you have a list like this:

SOMEFUNCTIONNAME	proc	far	param1:ParamType, 
					param2:optr,
					param3:word

where ParamType is a byte in size. This causes a problem because
the C compiler will push a byte-sized parameter onto the stack as
a word (a limitation of the Intel architecture) and the c-stub
must take the parameter as a multiple of a word size. Therefore
you must change the c-stub to something like this:

SOMEFUNCTIONNAME	proc	far	param1:word, 
					param2:optr,
					param3:word