Call a foreign-language function: Difference between revisions
no edit summary
(Added Odin variant) |
No edit summary |
||
Line 2,165:
"Hello World!"
</pre>
=={{header|PHP}}==
{{works with|PHP|7.4}}
PHP 7.4+ has as support to call external C-like functions using extension . See this Windows example:
<syntaxhighlight lang="php">$ffi = FFI::cdef("char *_strdup(const char *strSource);", "msvcrt.dll");
$cstr = $ffi->_strdup("success");
$str = FFI::string($cstr);
echo $str;
FFI::free($cstr);
</syntaxhighlight>
=={{header|PicoLisp}}==
The easiest is to inline the C code. Another possibility would be to write it
|