[vtk-developers] VTK/Python and Sun new discoveries

Bill Hoffman bill.hoffman at kitware.com
Fri May 24 14:22:03 EDT 2002


Just to put my two cents in....

I am fairly certain that the C++ standard requires that programs executing c++ code have the main() function compiled, and linked with a C++ compiler.   The problem is in order of initialization of the std C++ libraries.   If main() is compiled and linked by the c++ compiler, it will force global objects like cout, cerr, and other stream stuff to be initialized first.   Linux and win32 will not have this problem, because they essentially use the same compiler for C++ and C.    So, you will see this problem on IRIX, HP, SUN, and systems using the KAI compiler.     The fact that it only shows up in the TK stuff, is most likely chance, or that the TK stuff uses cout or cerr.  So, at the end of the day, if you are using C++, main should be compiled and linked by the C++ compiler.

The crash we saw in Python was in a global constructor being called in the initialization of the vtkRenderingPythonTkWidgets, I am not sure which one.   It may have just been the first
time cout was being done.   But if vtkRenderingPythonTkWidgets.so gets loaded by a c program it will initialize the globals in that library first, then in libCrun, but it has to be the other way for some compilers.




-Bill




More information about the vtk-developers mailing list