Call a foreign-language function: Difference between revisions

(→‎{{header|CMake}}: Warn about deprecation. Add instruction to run `cmake .`.)
Line 888:
=={{header|Julia}}==
Julia has a built-in keyword <code>ccall</code> to call external C-like functions. For example:
<lang julia>julia> p = ccall(:strdup, Ptr{Uint8Cuchar}, (Ptr{Uint8Cuchar},), "Hello world")
@show unsafe_string(p) # "Hello world"
Ptr{Uint8} @0x000000011731bde0
julia> ccall(:free, Void, (Ptr{Uint8Cuchar},), p)</lang>
 
</lang>
julia> bytestring(p) # convert pointer back to a native Julia string
"Hello world"
 
julia> ccall(:free, Void, (Ptr{Uint8},), p)</lang>
 
=={{header|Kotlin}}==
Anonymous user