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