autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fortran module name mangling


From: Frederik Beaujean
Subject: fortran module name mangling
Date: Sat, 17 Aug 2013 13:07:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]