Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-04 Thread Geordie Jay via swift-users
Fantastic! Thanks for the info, this is great news. While I have you, I'm interested in annotating function pointers. Specifically, the JNI environment instance is a pointer to a pointer, so as is you have to type env.pointee.pointee.FunctionName(env, param1, param2) Ideally this would just look

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-04 Thread Geordie Jay via swift-users
Great, thanks for reminding me of this feature. I couldn't see how it could be used outside of the stdlib though, is it possible to use apinotes when simply linking a C module via its modulemap ? Douglas Gregor schrieb am Fr. 5. Mai 2017 um 01:55: > > On May 3, 2017, at 4:10

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-04 Thread Douglas Gregor via swift-users
> On May 3, 2017, at 4:10 PM, Geordie J via swift-users > wrote: > > Hi everyone, > > I’m about to start on another big project with Swift on Android and would > like to annotate that JNI headers as much as possible before I do: > specifically I’d like to make

Re: [swift-users] Slicing a [UInt8] into a Data without copying?

2017-05-04 Thread Rick Mann via swift-users
Thanks! > On May 4, 2017, at 16:44 , Philippe Hausler wrote: > > Not sure on exactly how you are wanting to use this but you could approach > this like: > > let bytes: [UInt8] = [ 0xC0, 0xC0, 0xA1, 0x00, 0xC0, 0xC0, 0xA1, 0x00] > let slice = bytes[0..<4] >

Re: [swift-users] Slicing a [UInt8] into a Data without copying?

2017-05-04 Thread Philippe Hausler via swift-users
Not sure on exactly how you are wanting to use this but you could approach this like: let bytes: [UInt8] = [ 0xC0, 0xC0, 0xA1, 0x00, 0xC0, 0xC0, 0xA1, 0x00] let slice = bytes[0..<4] slice.withUnsafeBytes { buffer in let d = Data(bytesNoCopy: UnsafeMutableRawPointer(mutating:

[swift-users] Slicing a [UInt8] into a Data without copying?

2017-05-04 Thread Rick Mann via swift-users
Is it possible to make a (immutable) Data() object from a slice of a [UInt8] and avoid copying the data? -- Rick Mann rm...@latencyzero.com ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

[swift-users] Compiling Swift on Ubuntu to run on Centos

2017-05-04 Thread Lane Schwartz via swift-users
Hi, My understanding is that Swift is not yet running on RHEL based distros. If that is correct, I'd like to know whether it's possible (and practical) to compile a Swift program on Ubuntu such that the binary can be run on other Linux distros such as Centos, RHEL, etc. Thanks, Lane

[swift-users] Annotating C APIs without changing the original header files

2017-05-04 Thread Geordie J via swift-users
Hi everyone, I’m about to start on another big project with Swift on Android and would like to annotate that JNI headers as much as possible before I do: specifically I’d like to make _Nonnull and CF_SWIFT_NAME annotations to the headers found in a user's jni.h. The question is: is it

[swift-users] Using .gyb outside of the stdlib

2017-05-04 Thread Geordie J via swift-users
Hi again, another question: Is it possible to use .gyb files to automatically generate repetitive code outside of the stdlib? Preferably in a SwiftPM package? Here’s an example of what I’ve been using it for: https://github.com/SwiftAndroid/swift-jni/blob/master/JNIFields.swift.gyb

Re: [swift-users] Why does String.CharacterView have reserveCapacity(:)?

2017-05-04 Thread Brent Royal-Gordon via swift-users
> On May 2, 2017, at 12:35 PM, Kelvin Ma via swift-users > wrote: > > I’m wondering why the String.CharacterView structure has a reserveCapacity(:) > member? Because it conforms to the RangeReplaceableCollection protocol, which requires `reserveCapacity(_:)`. More

Re: [swift-users] stack trace of Swift executable

2017-05-04 Thread Greg Parker via swift-users
The stack trace printed by the process will never include file and line numbers. Swift and ObjC work the same way here. You want to find the crash report generated by the OS. Either it will have file and line numbers already, or it will contain enough information to look up the file and line

Re: [swift-users] Atomics and Memory Fences in Swift

2017-05-04 Thread Guillaume Lessard via swift-users
It works now, but it's not correct. I wish there were a correct way available. Guillaume Lessard > On May 3, 2017, at 21:30, Colin Barrett via swift-users > wrote: > > I haven't used this in production, but this repository looks pretty > promising. It's more or less