• 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: Quincey Morris <email@hidden>
  • Date: Fri, 11 Nov 2016 14:09:13 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sm84OsgVax:SMTPCORP

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.

 _______________________________________________
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

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

  • Prev by Date: Problems with a target that builds a static lib into a dylib
  • Next by Date: Re: Problems with a target that builds a static lib into a dylib
  • Previous by thread: C++ and Fortran - Help linking files
  • Next by thread: Re: C++ and Fortran - Help linking files
  • Index(es):
    • Date
    • Thread