
On Mon, Sep 03, 2007 at 02:56:52AM +0200, Bertram Felgenhauer wrote:
Here is a small complete example for illustration: Thank you for detailed explanation! It is very helpful!
Note that this function receives no additional context in its arguments. This is convenient but it means that each call to mkCallback has to return a different function pointer, so it is necessary to generate a small piece of code dynamically to implement it. This seems to be very different from usual FFI.
In Ocaml and Python a special function is used that takes a function and an arguments. For example: value caml_callback(value closure, value arg); http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#htoc233 PyObject* PyObject_CallObject(PyObject *func, PyObject *args) http://docs.python.org/api/object.html Why not use the same convention in Haskell? Anyway, have you any ideas about making this work under SELinux? It seems that dynamic code generation is used in many programs and there are some tricks to make it work. See for example http://people.redhat.com/drepper/selinux-mem.html section "Example code to avoid execmem violations" Is this possible to use this technique in GHC? With best regards, Alexander.