1

I am experimenting with porting the Tattiebogle Xbox 360 driver's preference pane to Swift. The custom classes were easy to do (and look cleaner than me moving them to modern Objective C), but the rest of the code constantly calls CFPlugInCOM APIs, which have a pointer to a pointer, which translates in Swift to UnsafeMutablePointer <UnsafeMutablePointer<IOCFPlugInInterface>>, which has a few CFunctionPointers in them. My question is this: can I call the functions that those CFunctionPointers point to in Swift?

MaddTheSane
  • 2,981
  • 24
  • 27
  • I am afraid you can't. Compare http://stackoverflow.com/questions/25514176/using-swift-cfunctionpointer-to-pass-a-callback-to-coremidi-api or http://stackoverflow.com/questions/25341632/pass-c-function-callback-in-swift – Martin R Nov 07 '14 at 23:07
  • I'm not looking to pass a Swift function as a callback to a C function; I'm looking to call a function that a `CFunctionPointer` points to. – MaddTheSane Nov 08 '14 at 01:18

1 Answers1

0

When Swift 2.0 is released, it will be possible to call C functions. They're even treated like Swift functions, and are not wrapped in a CFunctionPointer.

MaddTheSane
  • 2,981
  • 24
  • 27