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