Re: [swift-users] Passing a pointer to self to C function

2016-09-30 Thread John Brownie via swift-users
Thanks! That works just as it should. It's all compiling and unit tests are passing, so I can move on now. Mike Ferenduros 30 September 2016 at 14:14 The way to do this is via Unmanaged: let raw = Unmanaged.passUnretained(expat).toOpaque() gets you an Unsafe

Re: [swift-users] Passing a pointer to self to C function

2016-09-30 Thread Mike Ferenduros via swift-users
The way to do this is via Unmanaged: let raw = Unmanaged.passUnretained(expat).toOpaque() gets you an UnsafeMutableRawPointer you can pass into C functions. You can turn this back into an ExpatSwift with let expat = Unmanaged.fromOpaque(raw).takeUnretainedValue() There are also retained va