Frederik Beaujean
2013-08-17 11:07:42 UTC
Hello
I want to call a subroutine in a fortran module in C++ and discovered
the AC_FC_FUNC macro. It seems it does not work with fortran modules. So
the result it produces is useless. For concreteness, I want to call
nestRun from the multinest library defined in fortran as
module Nested
...
contains
subroutine nestRun(...)
...
end subroutine nestRun
end module Nested
On linux with gfortran 4.6 and autoconf 2.68, I try
AC_FC_FUNC(nestRun)
echo "mangled name:" $nestRun
and obtain
mangled name: nestrun_
but the actual name in the library is __nested_MOD_nestrun
Until now, the "recommended" procedure in multinest is to manually check
for either of the gnu or intel compiler and enter the mangled routine
name by hand. But this is hardly portable, as I just tried it out on the
old gfortran 4.2 on a mac, and the mangled name is different from the above.
Browsing the web, I found this document
http://www.netlib.org/lapack/lawnspdf/lawn270.pdf that describes how
cmake also supports module name mangling. If there is a standard way to
achieve this with autoconf, please let me know. Else I would like to
request that such a feature be included in autoconf as well.
Best regards
Fred
I want to call a subroutine in a fortran module in C++ and discovered
the AC_FC_FUNC macro. It seems it does not work with fortran modules. So
the result it produces is useless. For concreteness, I want to call
nestRun from the multinest library defined in fortran as
module Nested
...
contains
subroutine nestRun(...)
...
end subroutine nestRun
end module Nested
On linux with gfortran 4.6 and autoconf 2.68, I try
AC_FC_FUNC(nestRun)
echo "mangled name:" $nestRun
and obtain
mangled name: nestrun_
but the actual name in the library is __nested_MOD_nestrun
Until now, the "recommended" procedure in multinest is to manually check
for either of the gnu or intel compiler and enter the mangled routine
name by hand. But this is hardly portable, as I just tried it out on the
old gfortran 4.2 on a mac, and the mangled name is different from the above.
Browsing the web, I found this document
http://www.netlib.org/lapack/lawnspdf/lawn270.pdf that describes how
cmake also supports module name mangling. If there is a standard way to
achieve this with autoconf, please let me know. Else I would like to
request that such a feature be included in autoconf as well.
Best regards
Fred