You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <ma...@unipr.it> on 2011/03/14 18:30:37 UTC

extension libraries and Tcl stubs in Rivet

 I've been working on the segfault that occurs in Apache
 after mod_rivet loads Tcl extension libraries. The real
 cause of the fault is still somewhere in the fog
 of the dynamic loader, but I found out that loading
 the extension library by calling dlopen("<lib>",RTLD_NOW)
 gets around the hairy problem and maps in rivet a
 working extension.

 It seems that it's all about the second argument passed
 to dlopen, which for a Unix machine is set by Tcl as
 'RTLD_NOW | RTLD_GLOBAL'. This makes Apache crash again.

 The RTLD_GLOBAL flag was added years ago to overcome
 a problem that arises on certain platforms. It was
 decided to fix it in this way (without unanimity as
 far as I understand) and now it strikes back.

 I'm still testing the way we build extension
 libraries in Rivet, but as it turned out, we should
 build mod_rivet.so (an embedding application) by linking
 it to libtcl (the way it's done now), whereas we should
 compile the extension libraries librivetparser and
 librivetlib (formerly librivet) using the
 tcl stubs library. This should be changed anyway,
 regardless what I'm trying do to in order
 to get the whole command set loaded at module
 initialization.

 I must thank Jan Nijtmans and Kevin Kenny for the many
 suggestions and explanations they provided to me.

  -- Massimo



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org