chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Embedding Chicken in C++


From: felix winkelmann
Subject: Re: [Chicken-users] Embedding Chicken in C++
Date: Wed, 8 Nov 2006 08:46:22 +0100

On 11/7/06, Ivan Raikov <address@hidden> wrote:

Hello,

        I am trying to embed some Chicken code in a C++ application. I
have a C++ class with a constructor that calls
CHICKEN_intitialize(0, 0, 0, (void*)C_toplevel), and that call returns
0. Another method in the class subsequently makes the following call:

   C_word result = C_SCHEME_UNDEFINED;
   int status;
   status = CHICKEN_eval_string("(repl)", &result);

Unfortunately, this causes a segmentation fault. I have also tried
calling CHICKEN_run((void*)CHICKEN_default_toplevel) in the
constructor, and many other variations of this, but a segmentation
fault occurs in all cases. I am using Chicken 2.3. Has anyone had a
recent experience with embedding Chicken in a C or C++ program? My
code is attached to this message, if anyone is interested in looking
at it. I appreciate all and any help.

This shows a minimal example of emedding (you don't need
CHICKEN_initialize, unless you want to set specific buffer sizes):

/* gcc x.c -lchicken -o x */

int main()
{
 C_word x;

 CHICKEN_run(CHICKEN_default_toplevel);
 CHICKEN_eval_string("(print (+ 3 4))", &x);
 return 0;
}

Would it be possible for you to upgrade to a newer chicken version?
This would make it easier to figure out the problem.


cheers,
felix


--
http://galinha.ucpel.tche.br:8081/blog/blog.ssp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]