MoronicAcid MoronicAcid - 2 months ago 5
C Question

How does one create a C function pointer from a Scheme function in Guile?

I am trying to write a wrapper for a C library that contains a function which takes another function to achieve polymorphism (i.e. a generic function). I would like to write my wrapper such that it takes a Scheme function and passes it to the generic function as a C function pointer. Does Guile provide functionality that would allow me to turn a Scheme function into a C function pointer?

Answer

You have to use procedure->pointer procedure which is described in the manual.