In other words, I need to dynamically define this proc. But this doesn't work.
You left out perhaps the single most important piece of
information: Where are you trying to do this proc definition?
Each thread in Tcl - and in AOLserver - gets its own Tcl
interpreter. If you define your proc in a *.tcl page, it will of
course get (re)created every single time that page runs, and will
always be available while that page is running. Try that and see that
it works.
Next, to reduce the innefficiency of recreating the proc on every page
load, you should instead try to define your proc in a library at
AOLserver startup time, which automatically makes it available to all
threads. Whether that is feasible for you depends on why you're
trying to dynamically define your proc in the first place. You have a
full Tcl interpretor available at AOLserver startup time and can do
arbitrary programming, but naturally many of APIs you would use in a
connection thread don't make sense to use during server startup and
will fail if you call them then.