This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Is there a difference between applets and non-applets in terms of variable initialization?
- From: alex mitchell <lexaay at gmail dot com>
- To: "kawa at sources dot redhat dot com" <kawa at sources dot redhat dot com>
- Date: Wed, 10 Feb 2010 12:18:48 +0800
- Subject: Is there a difference between applets and non-applets in terms of variable initialization?
I have some code which runs fine when compiled with --main, but has problems
with un-initialized variables when compiled with --applet.
I'm requiring a file which contains several variables. The variables are
module-exported. Each variable is initialized by calling a procedure,
something like this:
; style for links
(define style-link (make-attribute-set))
(set-style-attributes style-link 'bold)
When I try to use style-links in the requiring file, I get a null pointer
exception when running the code compiled as an applet. So it seems that the
initialization, ie. (make-attribute-set), isn't being called when the file
is required. This problem doesn't occur when compiled with --main.
Is there any way I can work around this, or something I'm missing? One
option would be to move all my variable initializations into an "init"
procedure, and call that in the applet's "start" proc, but I'd rather not
have to do this.
thanks,
Alex