This is the mail archive of the guile@sources.redhat.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]

Capturing main - a heretical experiment.


As I understand it, guile needs to capture main to find the top of stack. This
is so the GC can scan for possible SCM values, that may be roots. Scanning the
whole stack is obviously safe, but may not be needed. If you can prove  that
there are no SCM values above the point where guile is started, then you can
avoid scanning the stack.

I tried this as a trivial hack. I took a biggish X+Motif progrramme, and left
all of main unchanged, except the last line, where it would jump into the
event loop (XtAppMainLoop). I put scm_boot_guile there, and ran the event loop
inside the inner main. Guile booted, and the application still ran normally.

Obviously this is trivial, and a better test requires doing no trivial work
in guile. But my beleif is that you can run arbitary C code before starting guile
provided you follow these rules.

1) No SCM globals.
2) No SCM variables in any code that runs before starting guile.
3) Don't try to sneak round 1+2 by casting!

Julian
<satchell@dera.gov.uk>

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