Re: Calling fcntl() and friends from Swift?
Re: Calling fcntl() and friends from Swift?
- Subject: Re: Calling fcntl() and friends from Swift?
- From: Roland King <email@hidden>
- Date: Sat, 18 Oct 2014 17:34:13 +0800
> On 18 Oct 2014, at 5:25 pm, Rick Mann <email@hidden> wrote:
>
> So far, my foray into Swift is going decently well. But I'm trying to re-write some code that uses IOKit and <sys/fcntl.h>, and while the IOKit calls are fine, it doesn't like me trying to call fcntl(). It says, "Use of unresolved identifier 'fcntl'".
>
> I've tried including <sys/fcntl.h> in my bridging header, I tried a few imports like "import sys" or "import fcntl" with no luck. I also haven't found anything by googling. Even searching for "Swift printf" didn't give me good results.
>
> Any ideas on how I can call these things? Thanks!
>
> --
> Rick Mann
> email@hidden
>
fcntl() wasn’t mapped in earlier versions of Swift, possibly still isn’t. If you can’t get to it with Darwin.fcntl() (and I don’t think you can) then you can’t get to it.
You can wrap it in a piece of objc and export it via a bridging header .. which is pretty ugh.
Bits of libdispatch were missing in earlier versions, I filed a bug against it and they eventually did show up.
_______________________________________________
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