You can usually make a very simple C shim that you can use to load the .so
in your nsd.tcl file, in the modules section, that is:

ns_section "ns/server/${sname}/modules"
ns_param pdflib       pdflib.so

(to continue with Jeremy's example, that is)

In general, to make an aolserver module out of a normal tcl module, you just
need to provide a Ns_ModuleInit() function which calls the interp init
function for the tcl module you're trying to load.

An example for pdflib:

int Ns_ModuleInit(char *server, char *module) {
    extern int Pdflib_Init();
    return Ns_TclInitInterps(server, Pdflib_Init, NULL);
}

I'm sure there is something similar for the other module you spoke of, you
just need to provide the proper Init function.  Most C-based tcl modules
have one that can be accessed like this.

I hope this helps,
Rusty


Jeremy Collins wrote:
>
> Here is how I solved the problem of loading a plain Tcl module into
> AOLserver.  I'd be interested in hearing other approaches.
>
> 1. Create AOLserver Tcl Library directory.
>
>    mkdir servers/server1/modules/tcl/pdflib
>    cp pdflib_tcl.so.1.1.1 servers/server1/modules/tcl/pdflib
>
> 2. Add init.tcl file in directory above with the following line.
>
>    load [ns_info tcllib]/pdflib/pdflib_tcl.so.1.1.1
>
> 3. Add Tcl Library to AOLserver config.
>
>    ns_section "ns/server/${servername}/modules"
>    ns_param   pdflib          Tcl
>
> Basically something like the above.  Of course this does not address any
> threading issues.  And I *believe* this will cause the module to only
> get loaded on thread creation, instead of every hit.
>
> Jeremy

Reply via email to