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

Re: How does the Swift Darwin module work?


  • Subject: Re: How does the Swift Darwin module work?
  • From: Marco S Hyman <email@hidden>
  • Date: Sat, 18 Oct 2014 18:17:55 -0700

>> So you get to go wrap fcntl() in something else it seems.
>
> So, how would I do that, exactly? I suppose I have to pass Objective-C collection types to a method (which could be a straight C function) from a Swift call? That is, can a Swift variadic call translate into a C function call that accepts Obj-C collections?

I don't think you need collections.  fcntl's third argument varies
according to the command.  It is not always needed.  Write a c file containing
wrappers that can be called from swift for the various commands you need. I'm
thinking something like this (untested).

int
fcntl_dupfd(int fildes, int arg)
{
	return fcntl(fildes, F_DUPFD, arg);
}

int
fcntl_getlk(int fildes, struct flock *arg)
{
	return fcntl(fildes, F_GETLK, arg)
}

etc. Will that work?


_______________________________________________

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


References: 
 >How does the Swift Darwin module work? (From: Rick Mann <email@hidden>)
 >Re: How does the Swift Darwin module work? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: How does the Swift Darwin module work? (From: Roland King <email@hidden>)
 >Re: How does the Swift Darwin module work? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: How does the Swift Darwin module work?
  • Next by Date: Re: How does the Swift Darwin module work?
  • Previous by thread: Re: How does the Swift Darwin module work?
  • Next by thread: Re: How does the Swift Darwin module work?
  • Index(es):
    • Date
    • Thread