Hello Denis, On Wed, Jun 02, 2010 at 10:30:15AM +0200, Denis Barbier wrote: > On 2010/6/2 Andre Espaze wrote: > > It is finally not necessary to build the module with the -g option, > > I have enclosed a patch that disable the GetIDMapper function inlining > > when built with g++ and optimizations. > > I am no C++ expert, but this looks very similar to > http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13 > and it is thus not clear whether this is really a g++ bug. > Here is a different fix, I tested this approach with Andre's > test.cpp, but not with salome. Thank you very much for the suggestion, it works but it seems to me that you forgot a 'template' keyword before the symbol export. I have enclosed a patch tested on my machine, fell free to correct it if I was wrong. For the -9 release, I am anyway going to submit my change to Adam for getting a working version with VISU. A full build will again be required because other symbol exports may be needed in other modules. Your solution is however better because the exported symbols are in control while in my case I remove every GetIDMapper function inlining. I am neither a C++ expert but I found the FAQ entry different from our case because the symbol gets exported without -O2 optimizations. I would not say that it is a g++ bug because I think that you should control inlining when optimizing (as I have done in my first patch). However your solution is right and succeeds to export template function symbols with optimizations. Once again thank you because I would not have figured it out myself.
Best regards, André
diff --git a/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.cxx b/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.cxx index 126effb..89d1b50 100755 --- a/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.cxx +++ b/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.cxx @@ -718,7 +718,12 @@ namespace VISU } return NULL; } - + // Explicit symbol export when compiling with g++ and optimizations, + // needed by VISUConvertor during linking + #if (__GNUG__ && __OPTIMIZE__) + template vtkIntArray* + GetIDMapper<TGetPointData>(TFieldList*, TGetPointData, const char* ); + #endif //--------------------------------------------------------------- template<class TGetFieldData>