Article # 254, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
Calling a library function in C from assembly.
Q. How do you call a library function in C, from assembly? A. If the C function is defined as: word _cdecl foo(word a, word b) Then do this in assembly to call it: push b push a call foo ; es, di, si, bx, cx trashed, ax holds return value add sp, 4 Else if the C function is defined as: dword _pascal foo(word a, word b) Then do this in assembly to call it: push a push b call FOO ; es, di, si, bx, cx trashed, dx.ax holds return value ; callee pops args off stack