At Fri, 5 Nov 2021 08:58:06 -0700 (PDT), "
thomas_d...@alumni.brown.edu" wrote:
> - What are the preconditions and error-handling setup for calling
> `racket_dynamic_require` and/or other `racket_*` functions?
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`.
> - How does one obtain a path from a C string to pass to
> `racket_dynamic_require`? (i.e. what's the equivalent idiom to
> `scheme_make_path`?
You can use `Sstring` to create a Scheme string from a C string or use
`Smake_bytevector` plus `memcpy` to create a Racket byte string. For
conversions like `bytes->path`, use `racket_primitive` to get the
Scheme/Racket function and call it.
> - There don't appear to be documented equivalents to SCHEME_CPTRP and
> SCHEME_CPTR_TYPE.
> What does `racket_cpointer_address` do if the argument is not a cpointer,
> and is there some way to check the type tag without triggering garbage
> collection?
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.
> - One of the hassles with Racket BC is that the garbage collection
> algorithm intetionally triggers segfaults and uses a signal handler to
> resolve them, marking it hard to use GDB on the larger embedded
> application. Does Racket CS have the same behavior, or is this not a
> problem anymore?
Racket CS does not do that --- so, that's something easier, for a
change.
Matthew