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