library encapsulates architecture-, OS- and compiler-specific function call
semantics in a virtual "bind argument parameters from left to right and then
call" interface allowing programmers to call C functions in a completely
In other words, instead of calling a function directly, the
library provides a mechanism to push the function parameters manually and to
issue the call afterwards.
Since the idea behind this concept is similar to call dispatching mechanisms
of virtual machines, the object that can be dynamically loaded with arguments,
and then used to actually invoke the call, is called CallVM. It is possible to
change the calling convention used by the CallVM at run-time. Due to the fact
that nearly every platform comes with one or more distinct calling conventions, the
library project intends to be a portable and open-source approach to the variety of
compiler-specific binary interfaces, platform specific subtleties, and so on...
creates a new CallVM object, where
specifies the max size of the internal stack that will be allocated and used to
bind the arguments to. Use
to destroy the CallVM object.
sets the calling convention to use. See dyncall.h for a list of
available modes. Note that some mode/platform combinations dont make any
sense (e.g. using a PowerPC calling convention on a MIPS platform) and are
resets the internal stack of arguments and prepares it for a new call.
This function should be called after setting the call mode (using dcMode), but
prior to binding arguments to the CallVM. Use it also when reusing a CallVM, as
arguments dont get flushed automatically after a function call invocation.
Note: you should also call this function after initial creation of the a CallVM
object, as dcNewCallVM doesnt do this, implicitly.
are used to bind arguments of the named types to the CallVM object. Arguments should
be bound in
left to right
order regarding the C function prototype.
call the function with the bound arguments and returning the named type, where
is a pointer to the function to call. After the invocation of the function
call, the argument values are still bound to the CallVM and a second call
using the same arguments can be issued. Call
to clear the internal argument stack.
can be used to bind arguments in a printf-style call, using a signature
string encoding the argument types and return type. The former 2 only bind
the arguments to the
object (and ignore return types specified in the
signature), whereas the latter two issue a call to the given function pointer,
afterwards. The return value will be stored in
For information about the signature format, refer to the
manual in PDF format.