Why is name mangling not standardized

The standard does not address implementation details. There are many, many things which depend on the implementation, and which prevent programs from working together: how the classes are laid out, the structure of the vtable, etc. In general, compilers will change the name mangling if they change any of these. This is intentional, as it … Read more

Is it possible to explicitly call a name mangled function?

You can, with some caveats. You either have to use the member function in a way that code will be generated or have it be not inline, and your mangled definition should be extern “C” to prevent “double mangling”. E.g.: #include <cstdio> struct Foo { const char* message; void goo(); }; void Foo::goo() { std::printf(“%s”, … Read more

g++ undefined reference although symbol is present in *.so file

The pedantically correct way to check that a .so exports a symbol is nm –demangle –dynamic –defined-only –extern-only <lib.so> | grep <symbol>. Without –defined-only your command also shows undefined symbols. Without –extern-only it also shows symbols with internal linkage which are unavailable for linking. It looks like you need to link another library because Gps_Ephemeris::Gps_Ephermeris() … Read more

Scala: How do I dynamically instantiate an object and invoke a method using reflection?

There is an easier way to invoke method reflectively without resorting to calling Java reflection methods: use Structural Typing. Just cast the object reference to a Structural Type which has the necessary method signature then call the method: no reflection necessary (of course, Scala is doing reflection underneath but we don’t need to do it). … Read more

tech