Jump to content

Call a foreign-language function: Difference between revisions

→‎{{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)`;
);
Cookies help us deliver our services. By using our services, you agree to our use of cookies.