Hi!

I'm trying to make a procedure that takes one argument (another procedure) and converts it to a C function, assigning it to a function pointer in C. Then I want to call that function from that pointer in C.
I'm aware that the typical way to do this is with c-declare in a static way, but I need to be able to achieve the same without using c-declare.

My current attempt:

(define (uno) 1)
(define bind (c-lambda (scheme-object) void "simple_callable = ___CAST(void (*)(),___arg1);"))
(bind uno)


...then the C part, same file:

// before
void (*simple_callable)(void);

// after (bind uno) is executed
(*simple_callable)();



I guess that I'm doing either the input type or the cast (or both) wrong. Probably I'm assuming to much simply casting a "scheme-object" to a void(*)(). Is this what I'm trying to do even possible?

Thanks a lot!

Álvaro