I am dynamically linking to a fortran static object and need to be able (at run time) to take the name of the fortran function (which is a C++ string) and name mangle it appropriately for the compiler. Is there any pre-built function that would serve this purpose? In the statically linked case I am using autoconf's FC_FUNC.
For clarity, I want a function that would be able to take a string, interpret it as a fortran subroutine name and mangle it appropriately for the given compiler. In psuedo-C++,:
std::string subroutine = "FORTRANSUBROUTINE";
std::string symbol = FortranMangle(subroutine);
std::cout << symbol << endl; // Would output something like "fortransubroutine_"
I do not know all of the used name mangling schemes to write this mysterious "FortranMangle" function, myself.