This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Exported variables are null when required from applet, but ok otherwise
- From: Per Bothner <per at bothner dot com>
- To: alex mitchell <lexaay at gmail dot com>
- Cc: "kawa at sourceware dot org" <kawa at sourceware dot org>
- Date: Sun, 02 May 2010 10:58:04 -0700
- Subject: Re: Exported variables are null when required from applet, but ok otherwise
- References: <C8032753.247B3%lexaay@gmail.com>
On 05/01/2010 09:57 PM, alex mitchell wrote:
That would be great, thanks!
It seems to me that when modules are required from an applet, the module
body is not evaluated. Variables and procedures are declared but variables
aren't initialized, and any code in the module body isn't executed. I tried
adding (module-static 'init-run)
at the top of the imported module as I
figured this would force the module body to be run, but this caused the
following error when running in appletviewer:
$ appletviewer applettest.html
called init.
called start.
java.lang.IllegalAccessError
at test.<clinit>(test.scm)
at applettest.start(applettest.scm:6)
at sun.applet.AppletPanel.run(AppletPanel.java:464)
at java.lang.Thread.run(Thread.java:637)
$
This fails because when you compile applettest.scm it recompiles
test.scm (even if you compile test.scm first and applettest.scm in a
second compilation command) - which causes it to extend Applet.
A workaround is to change applettest.scm to require the class rather
than the source file:
(require test)
instead of:
(require "test.scm")
There seems to be a couple of different issues here, which I'll
continue looking at, but hopefully this work-around is OK for you.
--
--Per Bothner
per@bothner.com http://per.bothner.com/