[vtk-developers] proposed vtk build changes
Michael Halle
halazar at media.mit.edu
Fri Sep 29 17:29:06 EDT 2000
No, I'm not saying include the objects from the implementation library
in the tcl wrapper library. I'm saying that when the tcl library gets
linked, the implementation library is linked with it (Using -L and -l).
In every Unix architecture I've used, that means that when the wrapper
library gets loaded at run time, it automatically drags in its
dependent libraries. That in turn means that the loading program
(say, wish) doesn't need to know anything about, say, libVTKCommon.so,
since libVTKCommonTcl.so knows about it instead.
In short, if your dynamically-loading application doesn't know about
vtk at all, the loaded libraries each need to know what other
libraries they are dependent on.
To do it right, each library should link with all the external
libraries it needs; for example, libVTKGraphics.so should link with
-lX11 -lXt -lXmu -lGL.... Then, an application that uses -lVTKGraphics
will get those supporting libraries, without having to know what they
are, just by loading VTKGraphics.so.
As a final example, imagine I wrote a new class library called
VTKExtension for vtk. It uses classes in Common and Graphics.
Assuming the Common and Graphics libs are linked with their
appropriate libraries, I can do the following (it can be cleaner using
tcl packages, but this is the basic mechanism):
wish
load ./libVTKCommonTcl.so; # <- brings in VTKCommon.so
load ./libVTKGraphicsTcl.so; # <- " " VTKGraphics.so and -lX11 -lXt -lGL...
load ./libVTKExtensionTcl.so;# <- only needs to bring in VTKExtension.so,
# since Graphics and Common are loaded already
# in wish
You could argue that ExtensionTcl should also link with Common and
Graphics, but that makes the make process much more complex, and
doesn't really buy you much. As suggested on the list, it's more
portable to do:
load vtktcl
function_that_loads_libVTKExtensionTcl_so
in this case, the first load brings all your vtk libs anyway, so all
you need to do is bring in VTKExtension Tcl (and, implicitly,
VTKExtensionTcl).
Make more sense?
--Mike
More information about the vtk-developers
mailing list