Skip to content

Commit e95b6b5

Browse files
committed
modffi: Add special 'C' code for passing a callback function pointer.
1 parent 4039a26 commit e95b6b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

unix/modffi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
* s - as argument, the same as "p", as return value, causes string
5252
* to be allocated and returned, instead of pointer value.
5353
*
54+
* TODO:
55+
* O - mp_obj_t, passed as is (mostly useful as callback param)
56+
* C - callback function
57+
*
5458
* Note: all constraint specified by typecode can be not enforced at this time,
5559
* but may be later.
5660
*/
@@ -108,6 +112,7 @@ STATIC ffi_type *char2ffi_type(char c)
108112
case 'L': return &ffi_type_ulong;
109113
case 'f': return &ffi_type_float;
110114
case 'd': return &ffi_type_double;
115+
case 'C': // (*)()
111116
case 'P': // const void*
112117
case 'p': // void*
113118
case 's': return &ffi_type_pointer;

0 commit comments

Comments
 (0)