This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
How to use a scheme function with C...
- To: Ariel Rios <jarios@usa.net>
- Subject: How to use a scheme function with C...
- From: Klaus Schilling <Klaus.Schilling@home.ivm.de>
- Date: Mon, 7 Jun 1999 11:44:07 +0200 (CEST)
- Cc: guile@cygnus.com
- References: <37597E54.64E01025@usa.net>
- Reply-To: Klaus.Schilling@home.ivm.de
Ariel Rios writes:
> I'd been using Guile for a while but only in scheme-only projects. Right
> I need to create a C program that at run-time may be able to use the
> guile interpreter and call a specific scheme function.
>
> For example let's suppose I want to create a C programe that receives a
> value and then call the function factorial declared in Scheme.
>
> "void main(){
> int a;
> name_of_function (a){ ;;this function should start the guile interpreter
> and evaluate
> (define (factorial n).... ;;the function factorial.
> .....
> ..... } }
You can't start the guile interpreter from some arbitray point inside
the program. Guile must be initialized when main is called and it can't
be exited without exiting the program.
Klaus Schilling