On Nov 11, 2016, at 13:49 , David Bourne <email@hidden> wrote:
extern "C" { void FR1(int *, int *); int FF1(int *); }
If this is correct in C++ then you don’t need C++ at all. This says that these functions use the C ABI, and you can call those directly from Swift (using a C header file, I guess).
However, this is different from the code you linked to in 2 ways:
1. You left out “__stdcall”, which is a Windows thing, but to use your declarations you have to be certain that the Fortran ABI on the Mac is the same as the C ABI on the Mac. (Probably is, but I don’t know.) Also, you need to be sure that you’re not mixing 32- and 64-bit architectures.
2. You didn’t actually provide Fortran routines called FR1 and FF1 in your example source. Instead, you showed a main program and a subroutine. In the linked code, there were actually two Fortran routines with these names.
I’m not sure if you assumed the above declarations were mere boilerplate, or if you misquoted your own code.
|