I think you're wrong ... Extern C is for disabling the mangling function; therefore, if you do this only for header files, when you try to link your garbled object code, the declared function names will not match the function names in the object file.
In any case, extern C will not add any portability if the entire application is compiled and linked to the same C ++ compiler, which is designed to mix C libraries with C ++ code.
If your code is in a common subset of C and C ++, you can already compile it with any compiler, but I see no reason for this (besides working on the principle of least surprise, since C ++ is more strict with some things).
fortran
source share