RosettaCodeData/Task/Call-a-foreign-language-function/8th/call-a-foreign-language-function.8th

9 lines
391 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
\ tell 8th what the function expects:
"ZZ" "strdup" func: strdup
"VZ" "free" func: free
\ call the external funcs
"abc" dup \ now we have two strings "abc" on the stack
strdup .s cr \ after strdup, you'll have the new (but duplicate) string on the stack
\ the ".s" will show both strings and you can see they are different items on the stack
free \ let the c library free the string