Replies: 3 comments
-
Avoiding the need to have separate native and bytecode stubs? That'd be useful, but I'm not sure it's sufficient to justify adding a dependency to
However, this is more interesting; avoiding the need to write stubs altogether for functions that use only unboxed values would be worthwhile. I think @mshinwell has looked at stubless C calls with unboxed values for native code. Using |
Beta Was this translation helpful? Give feedback.
-
I looked at what it is the path to add such feature in the interpreter, and it boils down to one feature: to be able to get the function pointer of the C function. In fact if just this feature is added it is easy to write a ppx and a library that does the remaining part (have a generic primitive that takes a function pointer, a prototype with unboxing information and an array of arguments). To the expression language |
Beta Was this translation helpful? Give feedback.
-
I like the idea of adding `external "name_of_the_symbol" to the expression language. It would be worth considering supporting the case where the symbol name is not static, too. |
Beta Was this translation helpful? Give feedback.
-
Would it be interesting to have the OCaml bytecode interpreter use libffi so that it is not necessary to create stubs specific to the bytecode? One could remove the need of a stub if they uses in addition the
[@unboxed]
annotation in an OCaml external declaration. As experts of libffi and ocaml stubs, would that be interesting? Would that simplifyocaml-ctypes
? Do you foresee problems?Beta Was this translation helpful? Give feedback.
All reactions