[gambit-list] cast scheme procedure to c function

Álvaro Castro-Castilla alvaro.castro.castilla at gmail.com
Tue Nov 22 19:52:51 EST 2011


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
(bind uno)

...then the C part, same file:

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

// after (bind uno) is executed

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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://webmail.iro.umontreal.ca/pipermail/gambit-list/attachments/20111123/c8e37019/attachment.html 

More information about the Gambit-list mailing list