Thanks! A couple follow-up questions inline.

On Monday, December 20, 2021 at 2:34:29 PM UTC-5 Matthew Flatt wrote:

> There's not really anything you can do to catch exception C-side right 
> now. If you need to catch exceptions, that has to be done Racket-side, 
> possibly with a helper created via `racket_eval`. 
>

So what happens from the perspective of embedding C code if an exception 
occurs in Racket code it calls?

You can get `cpointer?` using `racket_primitive`. To disable garbage 
> collection, I don't have a better idea than using `disable-interrupts` 
> and `enable-interrupts` (again, obtained via `racket_primitive`), 
> although that's limited in the sense that `disable-interrupts` could 
> itself allow a GC through before disabling interrupts, at least in 
> principle. 
>
 
I can't seem to locate `disable-interrupts` or `enable-interrupts`  via 
searching the docs, but it sounds like if I needed to compose a sequence of 
several calls into Racket while keeping a consistent view of memory on the 
C side, I could do something like:

racket_apply(racket_primitive("disable-interrupts"),Snil);
// sequence of racket_ function calls
racket_apply(racket_primitive("enable-interrupts"),Snil);

Does that sound correct?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/2c776d90-747f-4b57-b965-a08ad02bd3d0n%40googlegroups.com.

Reply via email to