previous
index
next

Library Design

Design considerations

The dyncall library encapsulates function call invocation semantics that depend on the compiler, operating system and architecture. The core library is driven by a function call invocation engine, named CallVM, that encapsulates a call stack to foreign functions and manages the following three phases that constitute a truly dynamic function call:

  1. Specify the calling convention. Some run-time platforms, such as Microsoft Windows on a 32-bit X86 architecture, even support multiple calling conventions.
  2. Specify the function call arguments in a specific order. The interface design dictates a left to right order for C and C++ function calls in which the arguments are bound.
  3. Specify the target function address, expected return value and invoke the function call.

The calling convention mode entirely depends on the way the foreign function has been compiled and specifies the low-level details on how a function actually expects input parameters (in memory, in registers or both) and how to return its result(s).


previous
index
next