Re: Recursion in foreign-safe-lambda

2025-09-22 Thread Massimo Nocentini via Chicken-users
Thank you Thomas, I have a progress using foreign-primitive for allocating objects. On the contrary, given the following definitions: (defineparse(foreign-primitivescheme-object(((constc-string) filename) (scheme-objectl)) "P(C_k, filename, l);")) where function P is defined in a companion c

Re: Recursion in foreign-safe-lambda

2025-09-20 Thread Thomas Chust via Chicken-users
Hello Massimo, I believe you can only allocate Scheme data from a foreign-primitive, not from a foreign[-safe]-lambda: The memory reserved by C_alloc lives *on the C stack*, so a C function that uses this primitive must never return. It can invoke a continuation to communicate a return value, but