-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathcfunc_closure.h
More file actions
46 lines (30 loc) · 845 Bytes
/
cfunc_closure.h
File metadata and controls
46 lines (30 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// CFunc::Closure class
//
// See Copyright Notice in cfunc.h
//
#ifndef cfunc_closure_h
#define cfunc_closure_h
#include "cfunc.h"
#include "cfunc_pointer.h"
#include "ffi.h"
#include <stdbool.h>
struct cfunc_closure_data {
CFUNC_TYPE_HEADER
mrb_state *mrb;
ffi_closure *closure;
ffi_cif *cif;
int argc;
mrb_value *arg_types;
ffi_type **arg_ffi_types;
mrb_value return_type;
void *closure_pointer;
int packed_args_size;
};
#define cfunc_closure_data_pointer(mrb, val) \
cfunc_pointer_ptr(val)
void init_cfunc_closure(mrb_state *mrb, struct RClass* module);
mrb_value cfunc_closure_new(mrb_state *mrb, mrb_value self);
mrb_value cfunc_closure_to_pointer(mrb_state *mrb, mrb_value self);
void cfunc_closure_call_binding(ffi_cif *cif, void *ret, void **args, void *self_);
#endif