manpagez: man pages & more
info bigloo
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

27.1.3 Importing an extern function

Function are imported using the <function-clause>.

<function-clause> → (<typed-ident> (<typed-ident>*) <string>)
     | (<typed-ident> (<typed-ident>+ . <typed-ident>) <string>)
     | (macro <typed-ident> (<typed-ident>*) <string>)
     | (macro <typed-ident> (<typed-ident>+ . <typed-ident>) <string>)

The function result type and Scheme name are extracted from the <typed-ident>; the <typed-ident> denotes the type of the function arguments and <string> is the C name of the function. Bigloo does not produce “C extern prototype” for macro functions (those introduced by macro clauses). If the typed identifier of the function does not contain any type information. Bigloo will emit a warning message when compiling and it will use a default C type (e.g. the int C type) as the return type of the function.

(module example
   (extern (macro prn::int (::string . ::long) "printf")))

(let ((n (read)))
   (prn #"fib(%d): %d\n" n (fib n)))

This document was generated on March 31, 2014 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.