For TechDraw PR, I have made lots of new templates, that need explicit template instantiation. Developing on Linux, I have gotten the GNU to eat my code, while compiling on Windows are still failing according to CI.
Do we have any Windows developers wanting to help out with those explicit template instantiation? It's an easy task and you don't need any prior experience with FreeCAD code!
Help with explicit template instantiation, PR#9499
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Help with explicit template instantiation, PR#9499
https://github.com/FreeCAD/FreeCAD/blob ... ension.cpp
For TechDrawGui the linker fails to get the symbols and the compiler cannot re-create them because the code is in the source files. For the explicit template specialization you have to use the export macro to export the symbols to the library.
For example:
For TechDrawGui the linker fails to get the symbols and the compiler cannot re-create them because the code is in the source files. For the explicit template specialization you have to use the export macro to export the symbols to the library.
For example:
Code: Select all
TechDrawExport template std::string CosmeticExtension::addCosmetic<CosmeticEdge>(BaseGeomPtr bg);
Re: Help with explicit template instantiation, PR#9499
I tried withwmayer wrote: ↑Wed May 24, 2023 9:15 am For TechDrawGui the linker fails to get the symbols and the compiler cannot re-create them because the code is in the source files. For the explicit template specialization you have to use the export macro to export the symbols to the library.
For example:Code: Select all
TechDrawExport template std::string CosmeticExtension::addCosmetic<CosmeticEdge>(BaseGeomPtr bg);
Code: Select all
TechDrawExport template std::string CosmeticExtension::addCosmetic<GeomFormat>(GeomFormat* cosmetic); // Compiler error
template TechDrawExport std::string CosmeticExtension::addCosmetic<GeomFormat>(GeomFormat* cosmetic); // Linker error
Re: Help with explicit template instantiation, PR#9499
Sorry, I wasn't around in the forum in the last five weeks but it looks you got https://github.com/FreeCAD/FreeCAD/pull/9499 working now, right?
Re: Help with explicit template instantiation, PR#9499
Yes, what you sent actually worked. Probably did a typo and then mistakingly concluded it didn't work.wmayer wrote: ↑Fri Jul 07, 2023 8:04 am Sorry, I wasn't around in the forum in the last five weeks but it looks you got https://github.com/FreeCAD/FreeCAD/pull/9499 working now, right?