How does the Swift Darwin module work?
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