Search code examples
c++fortranlowercase

C preprocessor macro to convert string of Fortran program to lowercase?


I would like to do the following:

In a FORTRAN program

call myPackageFunction("MPI_User_function")

...shall be transfered BY A C PREPROCESSOR MAKRO to...

call myPackageFunction("mpi_user_function_")

The reason why I want to do that is that the user of my package (an average MATLAB and Fortran user) doesn't have to know about the name mangling of Fortran, but in the same time doing this task for the user shall not slow done the package function.

Does someone know how I could do that? I would be most grateful for any help!


Solution

  • The C preprocessor cannot do this sort of transformation.

    You will probably need to write a custom script that does this, that is automatically called by your build system before the compiler runs.