#include "Guile.hxx"
+#include "Config.hxx"
namespace {
SCM handler (void*, SCM tag, SCM throw_args) {
GuileInterpreter::GuileInterpreter() {
scm_init_guile();
- scm_internal_catch(SCM_BOOL_T,
- (SCM (*)(void *))scm_c_eval_string,
- (void*)"(use-modules (system repl server))",
- handler, NULL);
- scm_internal_catch(SCM_BOOL_T,
- (SCM (*)(void *))scm_c_eval_string,
- (void*)"(spawn-server)",
- handler, NULL);
- scm_internal_catch(SCM_BOOL_T,
- (SCM (*)(void *))scm_c_eval_string,
- (void*)"(load-extension \"libfrida-guile\" \"scm_init_frida_module\")",
- handler, NULL);
+ scm_c_use_module("system repl server");
+ scm_call_0(scm_c_public_ref("system repl server", "spawn-server"));
+ scm_c_load_extension("libguile-frida-binding",
+ "scm_init_frida_module");
guile_output_port = scm_open_output_string();
guile_error_port = scm_open_output_string();
return 0;
}
+
+int GuileInterpreter::loadFile(const std::string& filename,
+ std::ostream& stdout,
+ std::ostream& stderr,
+ std::string& result) {
+ scm_c_primitive_load(filename.c_str());
+}