32 lines
744 B
Text
32 lines
744 B
Text
(namespace ffi
|
|
(def unload builtins.ffi.unload)
|
|
|
|
(def ctypes [
|
|
:i8 :i16 :i32 :i64
|
|
:u8 :u16 :u32 :u64
|
|
:f32 :f64
|
|
:ptr
|
|
:str
|
|
])
|
|
|
|
(defmacro extern [name libname]
|
|
(namespace $name
|
|
(builtins.ffi.load $libname)
|
|
(fn call [symbol signature args]
|
|
(builtins.ffi.call $libname symbol signature args)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmacro native [name libname]
|
|
(namespace $name
|
|
(builtins.ffi.load $libname)
|
|
(defmacro fn [name symbol args ret]
|
|
(def '$name #(builtins.ffi.call $libname '$symbol ['$args '$ret] %&))
|
|
)
|
|
$%&
|
|
)
|
|
)
|
|
|
|
(extern ucrtbase "ucrtbase.dll")
|
|
)
|