The reality however is that C++ code across module boundaries is used a lot. The whole of Qt is build around that. Also LLVM supports linking against MSVC C++ code on Windows and GCC C++ code on *nix.
Yes, but these are special features of the respective compilers, and is
explicetly documented for LLVM, with it's limitations (i.e. the documentation specifically states that there might be bugs with the inheritance because it is not fully compatible). This is not a language feature but a tooling feature.
And QT is actually a great example for this, because if you want to use QT in a different ecosystem, e.g. with the intel C++ compiler, you need to rebuild the whole QT SDK to ensure the compatibility, because the "standard" QT binaries are incompatible with the intel c++ ecosystem.
LLVM puts a great effort in being compatible with GCC and MSVC, but this is more the exception than the rule. Microsoft makes pretty much no efforts to be compatible with GCC and vice versa. And those are just the three big ones, theres also Intel C++ and Embarcaderos C++ Builder, which are again a story on their own.
Only things that are defined in the standard will work on all those systems, things that are not defined in the standard may work on some systems reliable, but not on others.
Nice!
I wonder why the private functions appear in the exported function list? It makes no sense to me.
Because private does not imply internal linkage. In fact it can't do that, because a function implementation can spread over multiple compilation unit. Take the following example:
test.h
class Foo {
int bar();
int fooBar() {
return bar() * 2;
}
};
test.cpp
#include "test.h"
int Foo::bar {
return 42;
}
If a file now includes test.h then the Foo::fooBar method will be located in the compilation of that file, but the Foo::bar method will be located in the test.cpp compilation unit. So for the fooBar method to call the bar method, they need to be linked together, which requires external linkage. Therefore, even though they are declared as private, they have external linkage, to accomodate for having the methods spread over multiple compilation units.
It's a bit of a mess with the C ELF system of compilation units, as it is much less well thought through than in basically any other language (and is something that C++ tries to fix for the past 30 years with namespaces, modules, etc.).