• 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
How does the Swift Darwin module work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How does the Swift Darwin module work?


  • Subject: How does the Swift Darwin module work?
  • From: Rick Mann <email@hidden>
  • Date: Sat, 18 Oct 2014 11:37:37 -0700

I need access to fcntl, so I thought I'd do what Apple does with Darwin. But I don't actually see how to do that. They create Darwin.stdio.fopen(), for example. But then how do they call the underlying C fopen()?

For that matter, Swift can call C functions directly in some cases, and not at all in others.

OH! Is it because fcntl is special? Check out its declaration:

	int	fcntl(int, int, ...) __DARWIN_ALIAS_C(fcntl);

__DARWIN_ALIAS_C is:

	#define __DARWIN_ALIAS_C(sym)	__asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03)

So, is there some magic module I can create in Swift to make that accessible to my Swift code?

--
Rick Mann
email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How does the Swift Darwin module work?
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: DOMDocument in 10.10
  • Next by Date: Set UICollectionView UIScrollViewDelegate delegate
  • Previous by thread: Re: One more Document app style question
  • Next by thread: Re: How does the Swift Darwin module work?
  • Index(es):
    • Date
    • Thread