mirror of
https://github.com/janet-lang/janet
synced 2025-01-13 09:00:26 +00:00
Update gtk example.
This commit is contained in:
parent
a45ef7a856
commit
3af7d61d3e
@ -5,7 +5,7 @@
|
|||||||
(defn ffi-context
|
(defn ffi-context
|
||||||
"Load a dynamic library and set it as the context for following declarations"
|
"Load a dynamic library and set it as the context for following declarations"
|
||||||
[location]
|
[location]
|
||||||
(setdyn :raw-native (ffi/native location)))
|
(setdyn :ffi-context (ffi/native location)))
|
||||||
|
|
||||||
(defmacro defnative
|
(defmacro defnative
|
||||||
"Declare a native binding"
|
"Declare a native binding"
|
||||||
@ -16,7 +16,7 @@
|
|||||||
(def $sig (symbol name "-signature-"))
|
(def $sig (symbol name "-signature-"))
|
||||||
(def $pointer (symbol name "-raw-pointer-"))
|
(def $pointer (symbol name "-raw-pointer-"))
|
||||||
~(upscope
|
~(upscope
|
||||||
(def ,$pointer :private (as-macro ,assert (,ffi/lookup (,dyn :raw-native) ,raw-symbol)))
|
(def ,$pointer :private (as-macro ,assert (,ffi/lookup (,dyn :ffi-context) ,raw-symbol)))
|
||||||
(def ,$sig :private (,ffi/signature :default ,ret-type ,;signature-args))
|
(def ,$sig :private (,ffi/signature :default ,ret-type ,;signature-args))
|
||||||
(defn ,name [,;defn-args]
|
(defn ,name [,;defn-args]
|
||||||
(,ffi/call ,$pointer ,$sig ,;defn-args))))
|
(,ffi/call ,$pointer ,$sig ,;defn-args))))
|
||||||
|
Loading…
Reference in New Issue
Block a user