RosettaCodeData/Task/Call-a-foreign-language-function/Phix/call-a-foreign-language-function.phix
2016-12-05 23:44:36 +01:00

9 lines
376 B
Text

constant shlwapi = open_dll("shlwapi.dll")
constant xStrDup = define_c_func(shlwapi,"StrDupA",{C_PTR},C_PTR)
constant kernel32 = open_dll("kernel32.dll")
constant xLocalFree = define_c_func(kernel32,"LocalFree",{C_PTR},C_PTR)
constant HelloWorld = "Hello World!"
atom pMem = c_func(xStrDup,{HelloWorld})
?peek_string(pMem)
if c_func(xLocalFree,{pMem})!=NULL then ?9/0 end if