mirror of
https://github.com/janet-lang/janet
synced 2024-12-27 00:40:26 +00:00
Add length method ffi/jitfn abstract values.
This commit is contained in:
parent
aa60c1f36a
commit
12286e4246
@ -10,3 +10,4 @@
|
||||
(def signature (ffi/signature :default :void))
|
||||
(ffi/call f signature)
|
||||
(print "called a jitted function with FFI!")
|
||||
(print "machine code: " (describe (string/slice f)))
|
||||
|
@ -244,10 +244,17 @@ static JanetByteView janet_ffijit_getbytes(void *p, size_t s) {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static size_t janet_ffijit_length(void *p, size_t s) {
|
||||
(void) s;
|
||||
JanetFFIJittedFn *fn = p;
|
||||
return fn->size;
|
||||
}
|
||||
|
||||
const JanetAbstractType janet_type_ffijit = {
|
||||
.name = "ffi/jitfn",
|
||||
.gc = janet_ffijit_gc,
|
||||
.bytes = janet_ffijit_getbytes
|
||||
.bytes = janet_ffijit_getbytes,
|
||||
.length = janet_ffijit_length
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
Loading…
Reference in New Issue
Block a user