Topic: More on modularity (classfactory)
Currently, to add a new component in OOFEM, you need to add it to CMakeLists.txt, class factory and classtype.
I've discussed classType in the other thread, and CMakeLists I think is acceptable.
I've experimented a little with distributing the components into their own files, and I have introduced all the functions and macros necessary to do this. All that's needed for each component is a single line like:
REGISTER_Element(MyElement);
in its source file.
With this, you could even link a separate shared library, which would register itself with the classfactory, without modifying any code inside OOFEM itself.
It works fine when using shared libraries, but with static libraries, internally used symbols are optimized away. There are compiler specific flags which forces all symbols to be included when linking static libraries, but I don't want to rely on those (afaik there is no way to do it with MSVC).
Linking all the objects files into a single executeable also works.
I'm planning on changing the CMakelists to allow for these two methods, getting rid of the static library completely.
Since also the python interface requires a shared library, I think we should consider fixing this for windows as well. The problem here is that windows requires all external functions to be declared manually. This means we need to do something along the lines of
// Compiler flag: -D__OOFEM_API __declspec(dllexport)
class __OOFEM_API MyClassin at least all the methods that main.C uses (which fortunately isn't that many)
I'm not sure if this is the case for mingw as well.