[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help needed on strange random error (Guile 2.0.9)
From: |
Sun Yijiang |
Subject: |
Re: Help needed on strange random error (Guile 2.0.9) |
Date: |
Tue, 10 Dec 2013 15:04:44 +0800 |
I managed to narrow the problem down to this:
(abbreviated code snippets)
/* from app.c */
static void init_builtins(void*) {
scm_c_define_gsubr(...)
scm_c_export(...)
...
}
static void _main(void *data, int argc, char* argv[]) {
// smob definitions
DEFINE_SMOB(....)
...
scm_c_define_module("builtin", init_builtins, NULL);
scm_c_eval_string(
"(current-warning-port (%make-void-port \"w\"))"
"(read-set! keywords 'prefix)"
"(add-to-load-path \"/my/scm/path\")"
"(use-modules (builtin) (ice-9 readline)) (activate-readline)"
);
scm_shell(argc, argv);
}
int main(int argc, char* argv[]) {
scm_boot_guile(argc, argv, _main, 0);
return 0;
}
/* end of app.c */
If I remove (use-modules (builtin)) but leave everything else the
same, the problem goes away. I can say I found a fix, but I still
don't know the cause.
Any idea?
Best,
Steve
2013/12/7 Ludovic Courtès <address@hidden>
>
> Sun Yijiang <address@hidden> skribis:
>
> > It's an application using Guile for extensions, involving a bunch of C++ /
> > Scheme code and need an environment to run, so I'm afraid it's not quite
> > possible to post them here. Besides, there are commercial secrets included.
> >
> > I know it's hard to get any help with such little infomation. I'll try to
> > post an example script that can reproduce this problem.
>
> That would be great.
>
> > Still, any hint on where I can start looking into this problem?
>
> First, in what context does ‘@@’ occur in the source? Normally you
> should rarely need to use it, but if you do, the correct syntax is:
>
> (@@ (foo) bar)
>
> which looks up private top-level variable ‘bar’ in module (foo).
>
> Second, the expression is being evaluated instead of run from compiled
> code (hence the ‘eval’ in the backtrace.) You should arrange to run
> compiled code instead, for instance by using ‘primitive-load’, which
> would auto-compile the source if needed.
>
> HTH,
> Ludo’.