6 Evaluation and Running Modules (CS)

The racket_apply function provides basic evaluation support, but racket_eval, racket_dynamic_require, and racket_namespace_require provide higher-level support for the most common evaluation tasks to initialize a Racket instance.

ptr

 

racket_eval

(

ptr s_expr)

Evaluates s_expr in the initial Racket thread using its current namespace, the same as calling eval. The s_expr can be an S-expression constructed with pairs, symbols, etc., or it can be a syntax object.

Use racket_namespace_require to initialize a namespace, or use racket_dynamic_require to access functionality without going through a top-level namespace. Although those functions are the same as using namespace-require and dynamic-require, they work without having those identifiers bound in a namespace already.

This function and others in this section are not meant to be called in C code that was called from Racket. See also Calling Procedures (CS) for a discussion of entry points versus re-entry points.

ptr

 

racket_dynamic_require

(

ptr module_path,

 

 

 

 

ptr sym_or_false)

The same as calling dynamic-require in the initial Racket thread using its current namespace. See also racket_eval.

ptr

 

racket_namespace_require

(

ptr module_path)

The same as calling namespace-require in the initial Racket thread using its current namespace. See also racket_eval.

ptr

 

racket_primitive

(

const char* name)

Accesses a primitive function in the same sense as vm-primitive from ffi/unsafe/vm.