File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include "runtime.h"
1313#include "binary.h"
1414
15+ /*
16+ * modffi uses character codes to encode a value type, based on "struct"
17+ * module type codes, with some extensions and overridings.
18+ *
19+ * Extra/overridden typecodes:
20+ * v - void, can be used only as return type
21+ * P - const void*, pointer to read-only memory
22+ * p - void*, meaning pointer to a writable memory (note that this
23+ * clashes with struct's "p" as "Pascal string").
24+ * s - as argument, the same as "p", as return value, causes string
25+ * to be allocated and returned, instead of pointer value.
26+ *
27+ * Note: all constraint specified by typecode can be not enforced at this time,
28+ * but may be later.
29+ */
30+
1531typedef struct _mp_obj_opaque_t {
1632 mp_obj_base_t base ;
1733 void * val ;
@@ -63,8 +79,8 @@ STATIC ffi_type *char2ffi_type(char c)
6379 case 'L' : return & ffi_type_ulong ;
6480 case 'f' : return & ffi_type_float ;
6581 case 'd' : return & ffi_type_double ;
66- case 'p ' : // Deprecated - conflicts with struct module
67- case 'P' :
82+ case 'P ' : // const void*
83+ case 'p' : // void*
6884 case 's' : return & ffi_type_pointer ;
6985 case 'v' : return & ffi_type_void ;
7086 default : return NULL ;
You can’t perform that action at this time.
0 commit comments