[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What's the current-module during gh_eval_str?
From: |
Marius Vollmer |
Subject: |
Re: What's the current-module during gh_eval_str? |
Date: |
07 Oct 2001 01:14:40 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Rob Browning <address@hidden> writes:
> > The module that contains the definition of a function has nothing to
> > do with the module that is the current one when that functions calls
> > `eval'.
>
> So given
>
> void
> c_display_curmod(void) {
> gh_display(gh_eval_str("(current-module)"));
> }
>
> and a scheme module that publishes this function
>
> (define-module (foo))
> (export c-display-curmod)
>
> and then some other code like this:
>
> (use-modules (foo))
> (display (current-module)) (newline)
> (c-display-curmod) (newline)
>
> Should I see the same module displayed twice because the module
> referred to from within C code via eval_str, has nothing to do with
> any module that C code might be accessed through?
Yes, exactly.
> If so, then I presume that if you want to write C functions that have
> access to the bindings of the module they're being exported from, they
> need to be using scm_module_lookup, or similar, right?
Yes, scm_c_call_with_current_module would also be a candidate.
- Re: What's the current-module during gh_eval_str?,
Marius Vollmer <=