Re: C calling Scheme and garbage collection

2019-06-30 Thread Mark H Weaver
Hi Isaac, Isaac Jurado writes: > I'm playing with event loop libraries implemented in C (libev, > libevent, etc... in my case libsystemd), but configuring them from > Guile. > > The qsort example in the documentation [1] seems safe because the > qsort C function directly calls back, so the callb

Re: C calling Scheme and garbage collection

2019-06-30 Thread Isaac Jurado
On Sat, Jun 29, 2019 at 7:44 PM Greg Troxel wrote: > Isaac Jurado writes: > > > On Thu, Jun 27, 2019 at 9:52 PM Greg Troxel wrote: > > > >> I have been down this path before, with guile and with lua. Basically, > >> if C (or non-scheme) has a pointer to a scheme object, then you need to > >> h

Re: C calling Scheme and garbage collection

2019-06-30 Thread Hans Ã…berg
> On 27 Jun 2019, at 21:52, Greg Troxel wrote: > > I have been down this path before, with guile and with lua. Basically, > if C (or non-scheme) has a pointer to a scheme object, then you need to > hold a logical reference for it and protect the scheme object, and when > the C pointer is dropp

Re: C calling Scheme and garbage collection

2019-06-30 Thread David Pirotte
Hello, >... > In my experience, it's definitely not ok to capture a pointer to a > scheme object and store it for later use without protecting the scheme > object from gc by holding a reference. I recently had a similar conversation, here is one of the emails of the thread, the one that lists a

Re: C calling Scheme and garbage collection

2019-06-29 Thread Greg Troxel
Isaac Jurado writes: > On Thu, Jun 27, 2019 at 9:52 PM Greg Troxel wrote: > >> I have been down this path before, with guile and with lua. Basically, >> if C (or non-scheme) has a pointer to a scheme object, then you need to >> hold a logical reference for it and protect the scheme object, and

Re: C calling Scheme and garbage collection

2019-06-28 Thread Isaac Jurado
On Thu, Jun 27, 2019 at 9:52 PM Greg Troxel wrote: > > I have been down this path before, with guile and with lua. Basically, > if C (or non-scheme) has a pointer to a scheme object, then you need to > hold a logical reference for it and protect the scheme object, and when > the C pointer is dro

Re: C calling Scheme and garbage collection

2019-06-27 Thread Greg Troxel
Isaac Jurado writes: > Hello, > > I'm playing with event loop libraries implemented in C (libev, libevent, > etc... in my case libsystemd), but configuring them from Guile. > > The qsort example in the documentation [1] seems safe because the qsort C > function directly calls back, so the callbac