• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ and Fortran - Help linking files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ and Fortran - Help linking files


  • Subject: Re: C++ and Fortran - Help linking files
  • From: David Bourne <email@hidden>
  • Date: Fri, 11 Nov 2016 19:03:47 -0700

ABI = Application Binary Interface?

> On Nov 11, 2016, at 3:09 PM, Quincey Morris <email@hidden> wrote:
>
> 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).

My problem was the link between C (or C++) and Fortran. Swift to C is another matter and uses a bridge file between C and Swift.

> 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.

Xcode 8.1 didn’t like the __stdcall bit

> 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.

They are on the page below.

Thanks, David

> I’m not sure if you assumed the above declarations were mere boilerplate, or if you misquoted your own code.

PS. The example given at http://www.neurophys.wisc.edu/comp/docs/not017/ has both the C++ and Fortran files.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >C++ and Fortran - Help linking files (From: David Bourne <email@hidden>)
 >Re: C++ and Fortran - Help linking files (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: C++ and Fortran - Help linking files
  • Next by Date: Re: C++ and Fortran - Help linking files
  • Previous by thread: Re: C++ and Fortran - Help linking files
  • Next by thread: Re: C++ and Fortran - Help linking files
  • Index(es):
    • Date
    • Thread