unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Running files from command-line vs. load'ing them
@ 2008-12-27 16:27 Daniel Kraft
  2008-12-28 10:59 ` Andy Wingo
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kraft @ 2008-12-27 16:27 UTC (permalink / raw)
  To: guile-user

Hi,

I'm working on a project which defines a guile module in C and then uses 
this new interpreter for running some Scheme code.  I have to admit that 
I'm relatively new to Guile, so I may well have done something 
completely wrong.

However, everything seems to work quite fine.  Unfortunatelly, there's a 
strange thing I've came across:

$ myguile -L ..
guile> (load "program.scm")

works just fine, whereas

$ myguile -L .. program.scm
ERROR: In procedure string-contains:
ERROR: Wrong type argument in position 1 (expecting string): #<winder 
b7d6e360>

I tried to find out more about the problem using --debug in addition on 
the commandline, but then it again works fine.

While I would happily accept that I did something completely wrong in my 
program, it seems to me as if there's some bug with Guile also.  As I 
understand it, all three calls above should (more or less) do the same 
thing.  Or shouldn't they?

Thank you very much,
Daniel





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running files from command-line vs. load'ing them
  2008-12-27 16:27 Running files from command-line vs. load'ing them Daniel Kraft
@ 2008-12-28 10:59 ` Andy Wingo
  2008-12-28 11:50   ` Daniel Kraft
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2008-12-28 10:59 UTC (permalink / raw)
  To: Daniel Kraft; +Cc: guile-user

Hi,

On Sat 27 Dec 2008 17:27, Daniel Kraft <d@domob.eu> writes:

> $ myguile -L .. program.scm
> ERROR: In procedure string-contains:
> ERROR: Wrong type argument in position 1 (expecting string): #<winder
> b7d6e360>

I think this means that your extension missed a GC reference somewhere,
and that a SCM that you have has been freed and replaced with a
"winder".

("Winders" are part of guile's dynamic-wind implementation and are not
normally exposed to scheme -- a pretty good indication that this is the
case.)

Probably what's happening is that GC runs at different times when
running from the command line, or when running with the repl loaded; or
that it has marked but not yet swept that cell; etc.

> As I understand it, all three calls above should (more or less) do the
> same thing.

Yep. But I think you'll find you forgot a GC reference. Check your SMOB
marking functions, or scm_gc_protect_object() calls for global
variables. 

Cheers,

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running files from command-line vs. load'ing them
  2008-12-28 10:59 ` Andy Wingo
@ 2008-12-28 11:50   ` Daniel Kraft
  2009-01-05 21:20     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kraft @ 2008-12-28 11:50 UTC (permalink / raw)
  To: guile-user

Andy Wingo wrote:
>> $ myguile -L .. program.scm
>> ERROR: In procedure string-contains:
>> ERROR: Wrong type argument in position 1 (expecting string): #<winder
>> b7d6e360>
> 
> I think this means that your extension missed a GC reference somewhere,
> and that a SCM that you have has been freed and replaced with a
> "winder".
> 
> ("Winders" are part of guile's dynamic-wind implementation and are not
> normally exposed to scheme -- a pretty good indication that this is the
> case.)
> 
> Probably what's happening is that GC runs at different times when
> running from the command line, or when running with the repl loaded; or
> that it has marked but not yet swept that cell; etc.

Thanks Andy, that was (of course) the case...  Now it seems to work 
(that means, I've not been able to get the error again).

Unfortunatelly, there's another such issue:

#<unknown-immediate 0xb7ded605>
Backtrace:
In
Exception during displaying of backtrace: wrong-type-arg

<unnamed port>: In procedure car in expression (car dgl):
<unnamed port>: Wrong type (expecting ~A): ~S


Do you have an idea what that could be?  When trying to (debug) I get a 
message about a wrong stack frame and guile crashes.  My guess would be 
some sort of memory violation in my C routines, but so far I'm not aware 
they do anything that could cause one.  Also, trying to run my 
guile-extension with valgrind does not work (but that's for a problem 
with my program, definitely not Guile).

Thank you very much,
Daniel





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running files from command-line vs. load'ing them
  2008-12-28 11:50   ` Daniel Kraft
@ 2009-01-05 21:20     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2009-01-05 21:20 UTC (permalink / raw)
  To: guile-user

Hi,

Daniel Kraft <d@domob.eu> writes:

> Unfortunatelly, there's another such issue:
>
> #<unknown-immediate 0xb7ded605>
> Backtrace:
> In
> Exception during displaying of backtrace: wrong-type-arg
>
> <unnamed port>: In procedure car in expression (car dgl):
> <unnamed port>: Wrong type (expecting ~A): ~S

That could be due to a dangling pointer in your code or some such.
Guile itself is not supposed to craft such `SCM' values.

Thanks,
Ludo'.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-05 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-27 16:27 Running files from command-line vs. load'ing them Daniel Kraft
2008-12-28 10:59 ` Andy Wingo
2008-12-28 11:50   ` Daniel Kraft
2009-01-05 21:20     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).