Re: [swift-users] How much memory does withMemoryRebound bind

2017-01-03 Thread Etan Kissling via swift-users
Thank you very much! > On 29 Dec 2016, at 23:03, Guillaume Lessard via swift-users > wrote: > > Hi Etan, > > `withMemoryRebound` does not copy memory. > The proposal for UnsafeRawPointer contains information about the memory model > (as related to pointers): > https://github.com/apple/swift-

Re: [swift-users] How much memory does withMemoryRebound bind

2016-12-29 Thread Etan Kissling via swift-users
b link below) >>> >>> It does not answer your question exactly, but I think it is a rather better >>> approach to sockaddr usage. >>> >>> Regards, >>> Rien >>> >>> Site: http://balancingrock.nl >>> Blog: http://s

Re: [swift-users] How much memory does withMemoryRebound bind

2016-12-29 Thread Etan Kissling via swift-users
n.blogspot.com > Github: http://github.com/Swiftrien > Project: http://swiftfire.nl > > > > >> On 29 Dec 2016, at 14:27, Etan Kissling via swift-users >> wrote: >> >> Hi, >> >> When calling POSIX accept, the common way is to >>

[swift-users] How much memory does withMemoryRebound bind

2016-12-29 Thread Etan Kissling via swift-users
Hi, When calling POSIX accept, the common way is to sockaddr_storage addr = {0}; sockaddr_len addrlen = 0; int clientFd = accept(serverFd, (sockaddr *) &addr, &addrlen); In Swift, this translates to var addr = sockaddr_storage() var addrlen = sockaddr_len(0) int clientFd = withUnsafeMutablePointe

Re: [swift-users] System Modules and pkgConfig

2016-12-29 Thread Etan Kissling via swift-users
in the module.modulemap's "header" >> directive and have it instead use pkgConfig values. >> >> >> >>> On 28 Dec 2016, at 17:12, Etan Kissling via swift-users >>> wrote: >>> >>> Hi, >>> >>> before Swi

Re: [swift-users] System Modules and pkgConfig

2016-12-28 Thread Etan Kissling via swift-users
Addition: Example system module as I have it now: https://github.com/Scriptreactor/SwiftCTLS I'd like to get rid of the absolute path in the module.modulemap's "header" directive and have it instead use pkgConfig values. > On 28 Dec 2016, at 17:12, Etan Kissling vi

[swift-users] System Modules and pkgConfig

2016-12-28 Thread Etan Kissling via swift-users
Hi, before Swift 3, for System Modules to work, these steps were necessary: 1. Creating module map 2. Creating System Module package 3. Creating git repo for System Module package, tagging with version 4. Referencing the System Module package from main package 5. Adding -Xcc -I and -Xlinker -L fla

Re: [swift-users] POSIX getaddrinfo memory behaviour

2016-10-04 Thread Etan Kissling via swift-users
Got an answer here: http://stackoverflow.com/questions/39857435/swift-getaddrinfo Current version: http://pastebin.com/y7nDATSH On 4 Oct 2016, at 19:30, Etan Kissling via swift-users mailto:swift-users@swift.org>> wrote: Yup (BTW I'm fine with the "ai_next" item becoming

Re: [swift-users] POSIX getaddrinfo memory behaviour

2016-10-04 Thread Etan Kissling via swift-users
iftySockets On Tuesday, October 4, 2016, Etan Kissling via swift-users > wrote: POSIX getaddrinfo allocates memory that must later be freed using freeaddrinfo. See http://manpages.ubuntu.com/manpages/xenial/en/man3/getaddrinfo.3.html To simplify the API, I've created this functio

[swift-users] POSIX getaddrinfo memory behaviour

2016-10-04 Thread Etan Kissling via swift-users
POSIX getaddrinfo allocates memory that must later be freed using freeaddrinfo. See http://manpages.ubuntu.com/manpages/xenial/en/man3/getaddrinfo.3.html To simplify the API, I've created this function: import Foundation enum SystemError: Swift.Error { case ge

[swift-users] Binding NSTextField value to NSNumber

2016-01-06 Thread Etan Kissling via swift-users
Hey there, I have a model that contains an optional NSNumber. @objc(Model) final class Model : NSObject { dynamic var someNumber: NSNumber? } I now bind such en object to an NSObjectController, and bind the value binding of an NSTextField to the object controller's selection.someNumber key

Re: [swift-users] Using NSObject subclass instance as key in Dictionary

2015-12-17 Thread Etan Kissling via swift-users
nko mailto:griboz...@gmail.com>> wrote: On Thu, Dec 17, 2015 at 2:17 PM, Etan Kissling via swift-users mailto:swift-users@swift.org>> wrote: I want to use instances of a custom class as Dictionary key. This requires the class to conform to Hashable. func ==(lhs: KeyType1, rhs: Ke

[swift-users] Using NSObject subclass instance as key in Dictionary

2015-12-17 Thread Etan Kissling via swift-users
I want to use instances of a custom class as Dictionary key. This requires the class to conform to Hashable. func ==(lhs: KeyType1, rhs: KeyType1) -> Bool { return lhs.id == rhs.id } final class KeyType1: Hashable, CustomStringConvertible { let id: String init(id: String) { self.id = id }