This is a VERY comprehensive set of examples by Doug Dumitu related to calling functions in glibc.
If the links dont work then search in http://groups.google.co.uk/group/OpenQM for "ccall.zip" or "Creating a VFS interface to D3" or 'The CCALL layer is a low-level "stack" processors.' and look for Dougs post on the 3 Sep 2007. The ccall.zip file is attached at the end.
Intro: Creating a VFS interface to D3 Look for Dougs post in this discussion.
"The CCALL layer is a low-level "stack" processor. It allows you to build the native C calling stack and then "call" a function. It assumes that you are very careful and understand calling conventions."