25 lines
550 B
Plaintext
25 lines
550 B
Plaintext
Section Header
|
|
|
|
+ name := TEST_C_INTERFACE;
|
|
|
|
// this will be inserted in front of the program
|
|
- external := `#include <string.h>`;
|
|
|
|
Section Public
|
|
|
|
- main <- (
|
|
+ s : STRING_CONSTANT;
|
|
+ p : NATIVE_ARRAY[CHARACTER];
|
|
|
|
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)`;
|
|
);
|