uppercase symbols

Tobias Burnus burnus@net-b.de
Thu Jan 22 14:11:00 GMT 2009


Hello Maik,

Maik Beckmann wrote:
> How to force gfortran to make symbols uppercase?
>
> My observation is that by default symbols are all lowercase:
> SUBROUTINE FooBar
>
> [maik@horst ~]$ objdump -x a.out |grep -i Foo
> 080484b4 g     F .text  00000005              foobar_
>   

I think there is no flag which does this. However, I think there a
certain case is mostly needed for interoperability with C - be it
calling library functions or be it a routine which is called from C.
Using C bindings, one can use the BIND(C, name="...") option to create
symbols of any name, as shown below. Note, however, that BIND(C) imposes
some other restrictions which may or may not cause problems in your
case. And note further that only newer Fortran compilers support this
Fortran 2003 feature.

Example:

subroutine foo(a, x) bind(C, name="Fo_O")
  use iso_c_binding
  implicit none
  integer(c_long) :: a
  real(c_double), value :: x
end subroutine foo

That is a subroutine which matches a C function with the following
declaration:

void Fo_O(long *a, double x);

$ gfortran -c test.f90
$ nm test.o |grep Fo
0000000000000000 T Fo_O

Does this help you or not? If not, can you outline why do you need to
have UPPERCASE PROCEDURE NAMES?

Regards,

Tobias



More information about the Fortran mailing list