Chris@19: /* Chris@19: * Copyright (c) 2003, 2007-14 Matteo Frigo Chris@19: * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology Chris@19: * Chris@19: * This program is free software; you can redistribute it and/or modify Chris@19: * it under the terms of the GNU General Public License as published by Chris@19: * the Free Software Foundation; either version 2 of the License, or Chris@19: * (at your option) any later version. Chris@19: * Chris@19: * This program is distributed in the hope that it will be useful, Chris@19: * but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@19: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@19: * GNU General Public License for more details. Chris@19: * Chris@19: * You should have received a copy of the GNU General Public License Chris@19: * along with this program; if not, write to the Free Software Chris@19: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Chris@19: * Chris@19: */ Chris@19: Chris@19: #include "api.h" Chris@19: Chris@19: /* if F77_FUNC is not defined, then we don't know how to mangle identifiers Chris@19: for the Fortran linker, and we must omit the f77 API. */ Chris@19: #if defined(F77_FUNC) || defined(WINDOWS_F77_MANGLING) Chris@19: Chris@19: #include "x77.h" Chris@19: Chris@19: #define F77(a, A) F77x(x77(a), X77(A)) Chris@19: Chris@19: #ifndef WINDOWS_F77_MANGLING Chris@19: Chris@19: #if defined(F77_FUNC) Chris@19: # define F77x(a, A) F77_FUNC(a, A) Chris@19: # include "f77funcs.h" Chris@19: #endif Chris@19: Chris@19: #if defined(F77_FUNC_) && !defined(F77_FUNC_EQUIV) Chris@19: # undef F77x Chris@19: # define F77x(a, A) F77_FUNC_(a, A) Chris@19: # include "f77funcs.h" Chris@19: #endif Chris@19: Chris@19: #else /* WINDOWS_F77_MANGLING */ Chris@19: Chris@19: /* Various mangling conventions common (?) under Windows. */ Chris@19: Chris@19: /* g77 */ Chris@19: # define WINDOWS_F77_FUNC(a, A) a ## __ Chris@19: # define F77x(a, A) WINDOWS_F77_FUNC(a, A) Chris@19: # include "f77funcs.h" Chris@19: Chris@19: /* Intel, etc. */ Chris@19: # undef WINDOWS_F77_FUNC Chris@19: # define WINDOWS_F77_FUNC(a, A) a ## _ Chris@19: # include "f77funcs.h" Chris@19: Chris@19: /* Digital/Compaq/HP Visual Fortran, Intel Fortran. stdcall attribute Chris@19: is apparently required to adjust for calling conventions (callee Chris@19: pops stack in stdcall). See also: Chris@19: http://msdn.microsoft.com/library/en-us/vccore98/html/_core_mixed.2d.language_programming.3a_.overview.asp Chris@19: */ Chris@19: # undef WINDOWS_F77_FUNC Chris@19: # if defined(__GNUC__) Chris@19: # define WINDOWS_F77_FUNC(a, A) __attribute__((stdcall)) A Chris@19: # elif defined(_MSC_VER) || defined(_ICC) || defined(_STDCALL_SUPPORTED) Chris@19: # define WINDOWS_F77_FUNC(a, A) __stdcall A Chris@19: # else Chris@19: # define WINDOWS_F77_FUNC(a, A) A /* oh well */ Chris@19: # endif Chris@19: # include "f77funcs.h" Chris@19: Chris@19: #endif /* WINDOWS_F77_MANGLING */ Chris@19: Chris@19: #endif /* F77_FUNC */