FFI
Background
Given a file named "pen.json" with:
{
"type": "library",
"dependencies": {}
}
Import a foreign function of native calling convention
Given a file named "Foo.pen" with:
import foreign g \(number) number
f = \(x number) number {
g(x)
}
When I run pen build
Then the exit status should be 0.
Import a foreign function of the C calling convention
Given a file named "Foo.pen" with:
import foreign "c" g \(number) number
f = \(x number) number {
g(x)
}
When I run pen build
Then the exit status should be 0.
Export a foreign function
Given a file named "Foo.pen" with:
foreign f = \(x number) number {
x
}
When I run pen build
Then the exit status should be 0.
Export a foreign function of the C calling convention
Given a file named "Foo.pen" with:
foreign "c" f = \(x number) number {
x
}
When I run pen build
Then the exit status should be 0.