guile-user
[Top][All Lists]
Advanced

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

Re: "unbound variable"


From: Peter Brett
Subject: Re: "unbound variable"
Date: Mon, 27 Jun 2011 10:41:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

"Tomas By" <address@hidden> writes:

> I have an extended Guile interpreter with a C function "get-map",
> defined by "scm_c_define_gsubr", that I then try to use in the
> (pure Scheme) module "mapdisplay", with the following result:
>
> [snip]
>
> Any ideas what is happening here? How can I debug it?

Having read the rest of this thread so far, I suggest that you put your
built-in functions into a module which can then be loaded by your pure
Scheme functions.

You need to do something like this:

  static SCM
  my_func (SCM arg)
  {
    /* ... blah blah ... */
  }

  static void
  init_builtins_module ()
  {
    scm_c_define_gsubr ("my-func", 1, 0, 0, my_func);
    scm_c_export ("my-func", NULL);
  }

  void
  init_builtins ()
  {
    scm_c_define_module ("myapp builtins",
                         init_builtins_module,
                         NULL);
  }

Then in your pure Scheme module, you can add:

  (use-modules (myapp builtins))

I hope that helps.

Regards,

                             Peter

-- 
Peter Brett <address@hidden>
Remote Sensing Research Group
Surrey Space Centre




reply via email to

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