Maybe for now you should try the following code: proc req_mk4tcl {} { if {[lsearch [info loaded] *mk4tcl.so*]<0} { load /usr/local/aolserver/lib/mk4tcl.so } }
And then you can load 'plain' Tcl extensions. Just put req_mk4tcl before any of your code that uses metakit. This is a little awful, but will get you started in 5 minutes. You may then add this command to nsd version of mk4tcl, which you are trying to build. You could just move the Tcl_Create*Command() to the req_mk4tcl (written in C this time), so that it creates commands when neccessary. You will have to use Tcl_SetAllocData() to store whether you already created commands/initialized other data for this interpreter. A little messy, but should work. I for now use libtbcload.so in the way described above - that is I wrote tbcload::bceval which renames itself and loads libtbcload.so and calls tbcload::bceval again :) Messy, but works fine... -- WK Jeff Rogers wrote: > On Mon, 1 Apr 2002 22:35:41 +0200, Jean-Claude Wippler <[EMAIL PROTECTED]> wrote: > > >>The segfault is bad of course, but there may be multiple issues here. >> >>Note that MK defines a mk::set command. So please change from: >> namespace eval ::mk {set n [namespace current]} >>to: >> namespace eval ::mk {::set n [namespace current]} >>As I assume that is what you intended? >> > > Yep, that certainly makes the error make sense. Qualifying the set command > fixes that problem. > > But AOLServer still doesn't like namespaces. In particular, commands (not > procedures) defined in a namespace. They seem to get lost and I haven't yet > found a way to get to them through 'namespace import' or anything like that. > > So I tried an alternate approach, again using renaming: this time, I > changed the mk4tcl code to create commands named __mk__file and so forth, > then from a startup file create tcl procedures ::mk::file et al. Since they > are procedures, they get recreated in the namespace. However, attempting to > use them gets back an error "Initialization error in dispatcher". I think > whats going on here is that mk4tcl creates a bunch of c++ objects on > initialization and registers an exit procedure to clean those up when the > tcl interpreter is destroyed; however AOLserver creates an interpreter for > startup and then destroys it and creates more when necessary, so mk4tcl is > left with references to destroyed objects. If this is correct, then either > mk4tcl (or the hypothetical aolserver version, ns_metakit) would need to > call the initialization procedure for each new interpreter (or otherwise > when necessary) or not register the exit procedure. > > The namespace thing still bugs me tho. > > -J > > > > -- WK "UTF-8 has a certain purity in that it equally annoys every nation, and is nobody's default encoding." -- Andy Robinson