Open aDifferentJT opened 1 year ago
Hi, do you have a working example that exhibits such issue? Any platform or compiler where newInstance
fails to find the program?
Indeed, I ran into this issue when linking the generated C++ file with a Rust program. At first I thought it was a Rust issue but they pointed out that this behaviour is allowed by the C++ standard.
Can you reproduce with a 100% C++ test? Would you like to suggest a fix?
I am not aware of a C++ compiler whose default linker behaves this way, nor is there an easy fix.
The C++ standard says that:
https://en.cppreference.com/w/cpp/language/initialization#Deferred_dynamic_initialization
Since the generated C++ files do not contain any variable or function that is odr-used this means that the compiler is free not to initialise the factory instance and so that factory doesn't get registered and
souffle::ProgramFactory::newInstance
fails to find the program.