Anonymous user
Call a foreign-language function: Difference between revisions
Call a foreign-language function (view source)
Revision as of 15:11, 19 September 2009
, 14 years ago→{{header|Lisaac}}: Explain backtick notation
(→{{header|Lisaac}}: Explain backtick notation) |
|||
Line 76:
=={{header|Lisaac}}==
Use backtick notation (`...`) for referencing foreign language (C) features.
<lang Lisaac>
Section Header
Line 81 ⟶ 82:
+ name := TEST_C_INTERFACE;
// this will be inserted in front of the program
- external := `#include <string.h>`;
Line 91 ⟶ 93:
s := "Hello World!";
p := s.to_external;
// this will be inserted in-place
// use `expr`:type to tell Lisaac what's the type of the external expression
p := `strdup(@p)` : NATIVE_ARRAY[CHARACTER];
s.print;
'='.print;
p.println;
// this will also be inserted in-place, expression type disregarded
`free(@p)`;
);
|