Use another language to call a function: Difference between revisions

m
(→‎{{header|Tcl}}: added zkl)
Line 1,072:
<lang c>// query.c
// export zklRoot=/home/ZKL
// clang query.c -I $zklRoot/VM -L $zklRoot/Lib -lzkl -pthread -lm -lc -lncurses -o query
// LD_LIBRARY_PATH=$zklRoot/Lib ./query
 
Line 1,089:
pVM vm;
MLIST(mlist,10);
 
// Bad practice: not protecting things from the garbage collector
 
// build the call parameters: ("query.zkl",False,False,True)
Line 1,094 ⟶ 1,096:
BoolFalse,BoolFalse,BoolTrue,ZNIL);
// Import is in the Vault, a store of useful stuff
// We want to call TheVault.Import.import("query.zkl",False,False,True)
// which will load/compile/run query.zkl
r = fcnRunith("Import","import",(Instance *)mlist,NoVM);
Line 1,115 ⟶ 1,117:
return 0;
}</lang>
Our query program. :
<lang zkl>// query.zkl
var query="Here am I";</lang>
Line 1,121 ⟶ 1,123:
{{out}}
<pre>
$ clang query.c -I $zklRoot/VM -L $zklRoot/Lib -lzkl -pthread -lm -lc -lncurses -o query
$ LD_LIBRARY_PATH=$zklRoot/Lib ./query
Query() --> "Here am I"
Anonymous user