[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
27.1.6.6 C functions
C function types are introduced by the <function-type> clause:
<function-type> →(function
<ident>(
<ident>*))
Let us suppose the array type declaration:
(type fun (function res (arg*)) ...)
Bigloo creates the following functions:
- A type checker:
(fun?::bool obj::obj)
This function returns
#t
if the argument obj is of type fun and#f
otherwise. - An equality checker:
(=fun*?::bool ::fun* ::fun*)
This function returns
#t
if and only if its arguments are equal. - Caller:
(fun-call::res f::fun a::ta ...)
This function invokes f with the arguments a … an.
Suppose we have to use in Scheme the following C variable:
double (*convert)(char *);
It can be done as in:
(module foo (extern (type *string->double (function double (string)) "double (*)(char *)") (macro cv::*string->double "convert"))) (print (*string->double-call cv "3.14"))
This document was generated on March 31, 2014 using texi2html 5.0.