-
-
Notifications
You must be signed in to change notification settings - Fork 91
Reini Urban edited this page Sep 21, 2013
·
10 revisions
sleep = extern sleep(seconds=N)
sleep(1)
load 'm' # load a shared library
sin = extern sin(num=d) -> d
sin(2.0)
crypto = class() {
load "ffi"
extern (link "-lcrypto") {
SHA1 = (src=*u8, sz=c_uint, out=*u8) -> *u8
MD5 = (src=*u8, sz=c_uint, out=*u8) -> *u8
SHA224 = (src=*u8, sz=c_uint, out=*u8) -> *u8
SHA256 = (src=*u8, sz=c_uint, out=*u8) -> *u8
SHA384 = (src=*u8, sz=c_uint, out=*u8) -> *u8
SHA512 = (src=*u8, sz=c_uint, out=*u8) -> *u8
}
}
See internal.c:potion_type_char
- calling convention within same ABI
- extern proto declaration in branch
extern
- calling convention with different ABI (syntax and code, no win64, no stdcall yet)
- either precompile each ffi proto to a signature translation wrapper, or translate the sigs at the call ext part in the vm, similar to filling in defaults.
- return type declaration syntax. like an optional
extern int sleep(sec=N)
. orextern sleep(sec=N) => N
- call it (vm and jit)
- move some of compile-time parts to the VM (OP_EXTERN dlsym). currently we can only call into already loaded libs, or load a lib at compile-time (as in p2 BEGIN{})
- non-core convenience ffi library for handling aggregate structs, ptrs, typical types.
- implement syntax C blocks to parse headers natively.