After some experimentation I figured out part of the problem, only to find
a different one.

It turns out that "load module" in a startup tcl file (apparently) works
fine.  I also wrote a little module that loads up another module and calls
its Module_Init procedure so it could be loaded from the config file.  That
also works fine.  The problem I was running into was namespaces; while they
also generally work fine I had changed my tcl library path to elsewhere so
namespace.tcl wasn't getting picked up.  Looking at the source to tclinit.c
it seems like there should be a default if the procedures aren't redefined
and that wasn't happenning, but that's temporarily beside the point.

Once I changed my library path back to the default and picked up
namespace.tcl (which only deals with procedures, not commands, so there may
be yet another issue in there) I got a new error:

view index is out of range
    while executing
    "set n [namespace current]"
(in namespace eval "::mk" script line 2)

To make things more interesting, this error is not specific to aolserver;
its reproducable with plain old tclsh:
Starting program: /usr/bin/tclsh
% load bin/Mk4tcl.so
% namespace eval ::mk {set n [namespace current]}
view index is out of range
% set ::mk::n
can't read "::mk::n": no such variable
% set ::mk::n 0
0
%
Program received signal SIGSEGV, Segmentation fault.
0x4027bbe6 in c4_Sequence::DecRef () from bin/Mk4tcl.so
(gdb) where
#0  0x4027bbe6 in c4_Sequence::DecRef () from bin/Mk4tcl.so
#1  0x4027942a in c4_View::operator= () from bin/Mk4tcl.so
#2  0x402544fe in MkWorkspace::Item::~Item () from bin/Mk4tcl.so
#3  0x40254972 in MkWorkspace::~MkWorkspace () from bin/Mk4tcl.so
#4  0x4025bbd5 in MkWorkspace::CleanupCommands () from bin/Mk4tcl.so
#5  0x40060ded in Tcl_Finalize () at eval.c:41
#6  0x40060c01 in Tcl_Exit () at eval.c:41
#7  0x4004bc6b in Tcl_ExitObjCmd () at eval.c:41
#8  0x4007e1cd in EvalObjv () at eval.c:41
#9  0x4007e89b in Tcl_EvalEx () at eval.c:41
#10 0x4007eb89 in Tcl_Eval () at eval.c:41
#11 0x40078d21 in Tcl_Main () at eval.c:41
#12 0x08048773 in main () at eval.c:41

To get around the namespace issue I tried renaming all the ::mk:: commanfs
to not be in a namespace with
rename ::mk::file __mk__file
and so forth, but doing that I got an error of
Initialization error in dispatcher
    while executing
"__mk__file open db /tmp/f1"

I still have a bunch more experimentation to do (not least of which is
recompiling everything to make sure everything's in sync, as I'm using the
prebuilt Mk4tcl.so), but this is some food for thought.

-J

Reply via email to