chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] ffi howto


From: Oleg Kolosov
Subject: Re: [Chicken-users] ffi howto
Date: Mon, 24 Nov 2014 10:35:06 +0300

On 21 Nov 2014, at 18:48, address@hidden wrote:
> 
> Hello,
> 
> I need some help getting started with ffi. 
> 
> I am attempting to bind libuv to scheme code.

Hello.

You can not just call lambda from foreign code because garbage collector moves 
those around and the program will eventually crash. You need to declare it as 
an external function like Richard suggested so it essentially becomes C 
function.

Incidentally, I’m experimenting with adding libuv to CHICKEN too. The idea is 
to just suspend the thread waiting for a callback and let the scheduler to 
figure out which lambda to call later. You can look at my early draft on:

https://github.com/bazurbat/chicken-scheme/blob/next/src/scheduler/scheduler-uv.scm

and accompanying scheduler.c which might give you ideas about FFI.

-- 
Regards, Oleg
Art System




reply via email to

[Prev in Thread] Current Thread [Next in Thread]