mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 05:10:55 +00:00
while loop support, and native functions (including ffi!)
This commit is contained in:
13
examples/ffi.pork
Normal file
13
examples/ffi.pork
Normal file
@ -0,0 +1,13 @@
|
||||
func malloc(size)
|
||||
native ffi "libc.dylib:malloc:void*"
|
||||
|
||||
func free(pointer)
|
||||
native ffi "libc.dylib:free:void"
|
||||
|
||||
export func main() {
|
||||
while true {
|
||||
let pointer = malloc(8192)
|
||||
println(pointer)
|
||||
free(pointer)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user