next up previous
Next: Embedding XASM-programs in C-applications Up: The XASM External Language Previous: The XASM External Language

External C-functions

In the previous section we have shown, that external function can be specified in XASM using the asm construct. Alternatively, external functions can be implemented in C. The corresponding XASM-declaration is given as follows:



\begin{asmbox}
\EXTERNAL \tab\verb*+''C:+c\_name\verb*+'' [+access\_mode\verb*+] +\FUNCTION
xasm\_name(a_1:T_1,\ldots,a_n:T_n) \rightarrow T\untab
\end{asmbox}


The c_name specifies the name of the C function; it can be omitted, if it is equal to the XASM-name of the function. Depending on the access mode of the XASM-function, the corresponding C-function prototypes differ slightly:

As an example, the following C-code contains the implementation of the ``stderr'' function previously used in one of the examples:




\fbox{\TheSbox}


The XASM-library function ``str_obj'' returns the string representation of an ASMOBJ. The corresponding declaration of the external C-function in an asm has the following format:



\begin{asmfbox}
\EXTERNAL \verb*+''C:xasm_stderr'' [output] + \FUNCTION stderr \rightarrow String
\end{asmfbox}


next up previous
Next: Embedding XASM-programs in C-applications Up: The XASM External Language Previous: The XASM External Language
Philipp Kutter 2002-03-18