This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Hobittable but nonexecutable code


>>>>> "Alexander" == Alexander Asteroth <alexander.asteroth@informatik.uni-bonn.de> writes:

>> a.out
Alexander> ERROR: In procedure apply:
Alexander> ERROR: Wrong type argument in position 1: %S

This seems like the often experienced problem relating to hobbits lack
of awareness of the guile module system. What is happening is that
the C code has problem in correctly resolving bindings such guile ends
up applying the undefined/unspecified value in place of the function
you really wanted to apply.

First of all be sure to use the -m flag to hobbit. This produces code
that is more robust wrt module problems.

You may also try to get rid of the guile specific defines such as
define-public. Hobbit knows and cares about define, but doesn't really
know about define-public (or define-macro for that matter). You can
try including the file `modules.scm' in the compilation. This is part
of the distribution and contains macros for define-public and friends
such that they are rewritten to something else. You can also just use
`define' and use the `export' form instead to export the public
symbols.

Finally you may want to find out which function is causing the
problem. The simple way of doing this is to use gdb, put a break point
on scm_error, and provoke the error. Stepping up the stack should find
the failing line, usually some horrible convoluted call of
scm_apply. One then needs to step through the set of H_ variables (in
arg position 1) to see which has a binding to unspecified or undefined
(which is, as I recall, a value around 9600).

You may need to extend you program with statements such as:

	(set! foo foo)

in order to reconnect foo with the actual value of foo. See also the
hobbit documentation which has some comments about modules.


---------------------------+--------------------------------------------------
Christian Lynbech          | Telebit Communications A/S                       
Fax:   +45 8628 8186       | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28  | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)