fortran.hpp
Go to the documentation of this file.
1 /*!
2  * \brief Defines Fortran naming conventions when binding to lapack routines
3  *
4  * \author O. Krause
5  * \date 2012
6  *
7  *
8  * \par Copyright 1995-2015 Shark Development Team
9  *
10  * This is based on boost::numeric::bindings, written by Toon Knapen and Kresimir Fresl
11  *
12  * <BR><HR>
13  * This file is part of Shark.
14  * <http://image.diku.dk/shark/>
15  *
16  * Shark is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU Lesser General Public License as published
18  * by the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * Shark is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public License
27  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
28  *
29  */
30 
31 #ifndef REMORA_KERNELS_LAPACK_FORTRAN_H
32 #define REMORA_KERNELS_LAPACK_FORTRAN_H
33 
34 #if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE) || defined(BIND_FORTRAN_LOWERCASE)
35 // Allow manual override of the defaults, e.g. if you want to use a fortran
36 // lib compiled with gcc from MSVC
37 #else
38 
39 // First we need to know what the conventions for linking
40 // C with Fortran is on this platform/toolset
41 #if defined(__GNUC__) || defined(__ICC) || defined(__sgi) || defined(__COMO__) || defined(__KCC)
42 #define BIND_FORTRAN_LOWERCASE_UNDERSCORE
43 #elif defined(__IBMCPP__) || defined(_MSC_VER)
44 #define BIND_FORTRAN_LOWERCASE
45 #else
46  #error do not know how to link with fortran for the given platform
47 #endif
48 
49 #endif
50 
51 // Next we define macro's to convert our symbols to
52 // the current convention
53 #if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE)
54 #define FORTRAN_ID( id ) id##_
55 #elif defined(BIND_FORTRAN_LOWERCASE)
56 #define FORTRAN_ID( id ) id
57 #else
58 #error do not know how to bind to fortran calling convention
59 #endif
60 
61 #endif