Next: Memory management for C, Previous: Using pragma foreign_decl for C, Up: Interfacing with C [Contents]
Definitions of C functions or global variables may be included using a declaration of the form
:- pragma foreign_code("C", Code).
For example,
:- pragma foreign_code("C", " int bar = 42; void foo(void) {} ").
Such code is copied verbatim into the generated C file.