Dynamic linking

From ScarletDME
Jump to: navigation, search

The CCALL interface is an OpenQM opcode that allows direct access to dynamically linked C libraries. What this means to us is that you can call C functions from within QM-Basic.

Warning! Like all low level programming, this is an inherently dangerous activity. It is easy to crash QM processes using this interface, which can lead to data corruption. If your functionality can be implemented as a separate ansyncronous process, consider using the socket libraries, which provide a safer interface.

ccall.zip

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.

File: ccall.zip

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."