That will work if your namespace has `open-input-bytes`, etc. It might be better to use `racket_dynamic_require` to specifically get the functions from `racket/base`, applying each with `racket_apply`.
A better strategy might be to have a function that combines all of these pieces in an embedded module, and then there's just one function to get and call. In general, that fits better with Racket CS, which really wants as much as possible to be on the Racket side. Matthew At Wed, 16 Dec 2020 08:55:06 -0800 (PST), Dan Dexter wrote: > I'm porting existing code that is embedding racket and I'm going from > racket-bc to racket-cs. > > In racket-bc, the code is calling scheme_eval_string() and > scheme_eval_string_all(). > > I don't see a direct replacement for these functions in racket-cs. Based > on the embedding example in the docs, I'm currently using the following: > > void EvalString(const std::string& str) > { > ptr expr = to_bytevector(str.c_str()); > expr = Scons(Sstring_to_symbol("open-input-bytes"), Scons(expr, Snil)); > expr = Scons(Sstring_to_symbol("read"), Scons(expr, Snil)); > expr = Scons(Sstring_to_symbol("eval"), Scons(expr, Snil)); > racket_eval(expr); > } > > Would this be equivalent? And also equivalent to scheme_eval_string_all() ? > --< Dan >-- -- 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 racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20201217204250.2af%40sirmail.smtps.cs.utah.edu.