// main.c
#include <stdio.h>
#include <chibi/eval.h>
// (define-c void callme())
void callme(void) {
puts("chibi_call");
}
int main(int argc, char *argv[]) {
// init ctx
sexp ctx = sexp_make_eval_context(NULL, NULL, NULL, 0, 0);
sexp_load_standard_env(ctx, NULL, SEXP_SEVEN);
sexp_load_standard_ports(ctx, NULL, stdin, stdout, stderr, 0);
// init lib
sexp_init_library(ctx, NULL, 3, sexp_context_env(ctx), sexp_version, SEXP_ABI_IDENTIFIER);
sexp_gc_var1(obj1);
// call it
puts("begin call it");
sexp_gc_preserve1(ctx, obj1);
obj1 = sexp_eval_string(ctx, "(callme)", -1, NULL); // callme is never called
sexp_gc_release1(ctx);
puts("end call it");
// finish up
sexp_destroy_context(ctx);
return 0;
}
/* Automatically generated by chibi-ffi; version: 0.4 */
#include <chibi/eval.h>
/*
types: ()
enums: ()
*/
sexp sexp_callme_stub (sexp ctx, sexp self, sexp_sint_t n) {
sexp res;
res = ((callme()), SEXP_VOID);
return res;
}
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
sexp_gc_var3(name, tmp, op);
if (!(sexp_version_compatible(ctx, version, sexp_version)
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
return SEXP_ABI_ERROR;
sexp_gc_preserve3(ctx, name, tmp, op);
op = sexp_define_foreign(ctx, env, "callme", 0, sexp_callme_stub);
if (sexp_opcodep(op)) {
sexp_opcode_return_type(op) = SEXP_VOID;
}
sexp_gc_release3(ctx);
return SEXP_VOID;
}
void callme(void) {
puts("chibi_call");
}
--
You received this message because you are subscribed to the Google Groups "chibi-scheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chibi-scheme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chibi-scheme/e15dad02-94e6-48f9-888c-d42d0084bcea%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to chibi-...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to chibi-scheme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chibi-scheme/00106096-c8a7-4dbc-9c60-d2a4c968d6b9%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chibi-scheme/00106096-c8a7-4dbc-9c60-d2a4c968d6b9%40googlegroups.com.
-DSEXP_USE_GREEN_THREADS=0 defined.
SEXP_USE_GREEN_THREADS 0
before #include <chibi/eval.h>.
It is insufficient to simply define the preprocessor directive to 0 when compiling the chibi scheme codebase.
-Mike
--
You received this message because you are subscribed to the Google Groups "chibi-scheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chibi-scheme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chibi-scheme/2df4fb5d-0d09-439a-9b40-51dccccc826do%40googlegroups.com.