Next: , Previous: Using pragma foreign_decl for C, Up: Interfacing with C


14.9.1.7 Using pragma foreign_code for C

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.