[swift-users] protocol where clause problem

2017-01-11 Thread adelzhang via swift-users

hello all!

I'm wondering if somebody can explain following snippet to me.

protocol P {
associatedtype Element
func next() -> Element
}

protocol Q {
associatedtype T : P
func makeT() -> T
}

extension Q where Self.T == Self {
func makeT() -> Self {
return self
}
}

// Why class A conform to protocol Q successfully?
class A: Q, P {
func next() -> Int {
return 0
}
}

`class A` does not declare associated type `T` explicitly. Why where  
clause check is passed ?



---
Regards

--adel
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] [unrelated-to-swift] an issue with structs in C++?

2017-01-11 Thread Saagar Jha via swift-users
Looks like someone’s trying to solve the Mt. Chiliad Mystery :) Anyways, it 
appears that “Epsilon Building” has 5 members instead of 4. That’s probably 
causing the issue.

Saagar Jha

> On Jan 11, 2017, at 8:46 PM, Ethin Probst via swift-users 
>  wrote:
> 
> Hello all,
> I have the following structured array:
>   static struct {
>   LPCSTR text;
>   float x;
>   float y;
>   float z;
>   } lines[5] = {
>   { "MARKER" },
>   { "MICHAEL'S HOUSE", -852.4f, 
> 160.0f, 65.6f },
>   { "FRANKLIN'S HOUSE", 7.9f, 548.1f, 175.5f },
>   { "TREVOR'S TRAILER", 1985.7f, 3812.2f, 32.2f },
>   { "AIRPORT ENTRANCE", -1034.6f, -2733.6f, 13.8f },
>   { "AIRPORT FIELD", -1336.0f, -3044.0f, 13.9f },
>   { "ELYSIAN ISLAND", 338.2f, -2715.9f, 38.5f },
>   { "JETSAM", 760.4f, -2943.2f, 5.8f },
>   { "STRIPCLUB", 127.4f, -1307.7f, 29.2f },
>   { "ELBURRO HEIGHTS", 1384.0f, -2057.1f, 52.0f },
>   { "FERRIS WHEEL", -1670.7f, -1125.0f, 13.0f },
>   { "CHUMASH", -3192.6f, 1100.0f, 20.2f },
>   { "WINDFARM", 2354.0f, 1830.3f, 101.1f },
>   { "MILITARY BASE", -2047.4f, 3132.1f, 32.8f },
>   { "MCKENZIE AIRFIELD", 2121.7f, 4796.3f, 41.1f },
>   { "DESERT AIRFIELD", 1747.0f, 3273.7f, 41.1f },
>   { "CHILLIAD", 425.4f, 5614.3f, 766.5f },
>   {"Strip Club DJ Booth", 126.135f, -1278.583f, 29.270f},
> {"Blaine County Savings Bank", -109.299f, 6464.035f, 31.627f},
> {"Police Station", 436.491f, -982.172f, 30.699f},
> {"Humane Labs Entrance", 3619.749f, 2742.740f, 28.690f},
> {"Burnt FIB Building", 160.868f, -745.831f, 250.063f},
> {"North Yankton Bank", 5309.519f, -5212.375f, 83.522f},
> {"10 Car Garage Back Room", 223.193f, -967.322f, 99.000f},
> {"Humane Labs Tunnel", 3525.495f, 3705.301f, 20.992f},
> {"Ammunation Office", 12.494f, -1110.130f, 29.797f},
> {"Ammunation Gun Range",  22.153f, -1072.854f, 29.797f},
> {"Trevor's Meth Lab", 1391.773f, 3608.716f, 38.942f},
> {"Pacific Standard Bank Vault", 255.851f, 217.030f, 101.683f},
> {"Lester's House", 1273.898f, -1719.304f, 54.771f},
> {"Floyd's Apartment", -1150.703f, -1520.713f, 10.633f},
> {"FIB Top Floor", 135.733f, -749.216f, 258.152f},
> {"IAA Office", 117.220f, -620.938f, 206.047f},
> {"Pacific Standard Bank", 235.046f, 216.434f, 106.287f},
> {"Fort Zancudo ATC entrance", -2344.373f, 3267.498f, 32.811f},
> {"Fort Zancudo ATC top floor", -2358.132f, 3249.754f, 101.451f},
> {"Damaged Hospital", 356.822f, -590.151f, 43.315f},
> {"Slaughterhouse", -80.557f, 6220.006f, 31.090f},
> {"Los Santos County Coroner Office/Morgue", 243.351f, -1376.014f, 39.534f},
> {"Torture Room",  147.170f, -2201.804f, 4.688f},
> {"O'neil Ranch",  2441.216f, 4968.585f, 51.707f},
> {"Main LS Customs", -365.425f, -131.809f, 37.873f},
> {"Yacht", -2023.661f, -1038.038f, 5.577f},
> {"Carrier (MP Only)", 3069.330f, -4704.220f, 15.043f},
> {"Fort Zankudo UFO", 2052.000f, 3237.000f, 1456.973f},
> {"Very High Up", -129.964f, 8130.873f, 6705.307f},
> {"IAA Roof", 134.085f, -637.859f, 262.851f},
> {"FIB Roof", 150.126f, -754.591f, 262.865f},
> {"Maze Bank Roof", -75.015f, -818.215f, 326.176f},
> {"Top of the Mt Chilad", 450.718f, 5566.614f, 806.183f},
> {"Most Northerly Point", 24.775f, 7644.102f, 19.055f},
> {"Vinewood Bowl Stage", 686.245f, 577.950f, 130.461f},
> {"Sisyphus Theater Stage", 205.316f, 1167.378f, 227.005f},
> {"Director Mod Trailer", -20.004f, -10.889f, 500.602f},
> {"Galileo Observatory Roof", -438.804f, 1076.097f, 352.411f},
> {"Kortz Center", -2243.810f, 264.048f, 174.615f},
> {"Chumash Historic Family Pier", -3426.683f, 967.738f, 8.347f},
> {"Paleto Bay Pier", -275.522f, 6635.835f, 7.425f},
> {"God's thumb", -1006.402f, 6272.383f, 1.503f},
> {"Calafia Train Bridge", -517.869f, 4425.284f, 89.795f},
> {"Altruist Cult Camp", -1170.841f, 4926.646f, 224.295f},
> {"Maze Bank Arena Roof", -324.300f, -1968.545f, 67.002f},
> {"Marlowe Vineyards", -1868.971f, 2095.674f, 139.115f},
> {"Hippy Camp", 2476.712f, 3789.645f, 41.226f},
> {"Devin Weston's House", -2639.872f, 1866.812f, 160.135f},
> {"Abandon Mine", -595.342f, 2086.008f, 131.412f},
> {"Weed Farm", 2208.777f, 5578.235f, 53.735f},
> {"Stab City",  126.975f, 3714.419f, 46.827f},
> {"Airplane Graveyard Airplane Tail", 2395.096f, 3049.616f, 60.053f},
> {"Satellite Dish Antenna", 2034.988f, 2953.105f, 74.602f},
> {"Satellite Dishes",  2062.123f, 2942.055f, 47.431f},
> {"Windmill Top", 2026.677f, 1842.684f, 133.313f},
> {"Sandy Shores Building Site Crane", 1051.209f, 2280.452f, 89.727f},
> {"Rebel Radio", 736.153f, 2583.143f, 79.634f},
> {"Quarry", 2954.196f, 2783.410f, 41.004f},
> {"Palmer-Taylor Power Station Chimney",  2

[swift-users] [unrelated-to-swift] an issue with structs in C++?

2017-01-11 Thread Ethin Probst via swift-users
Hello all,
I have the following structured array:
static struct {
LPCSTR text;
float x;
float y;
float z;
} lines[5] = {
{ "MARKER" },
{ "MICHAEL'S HOUSE", -852.4f, 
160.0f, 65.6f },
{ "FRANKLIN'S HOUSE", 7.9f, 548.1f, 175.5f },
{ "TREVOR'S TRAILER", 1985.7f, 3812.2f, 32.2f },
{ "AIRPORT ENTRANCE", -1034.6f, -2733.6f, 13.8f },
{ "AIRPORT FIELD", -1336.0f, -3044.0f, 13.9f },
{ "ELYSIAN ISLAND", 338.2f, -2715.9f, 38.5f },
{ "JETSAM", 760.4f, -2943.2f, 5.8f },
{ "STRIPCLUB", 127.4f, -1307.7f, 29.2f },
{ "ELBURRO HEIGHTS", 1384.0f, -2057.1f, 52.0f },
{ "FERRIS WHEEL", -1670.7f, -1125.0f, 13.0f },
{ "CHUMASH", -3192.6f, 1100.0f, 20.2f },
{ "WINDFARM", 2354.0f, 1830.3f, 101.1f },
{ "MILITARY BASE", -2047.4f, 3132.1f, 32.8f },
{ "MCKENZIE AIRFIELD", 2121.7f, 4796.3f, 41.1f },
{ "DESERT AIRFIELD", 1747.0f, 3273.7f, 41.1f },
{ "CHILLIAD", 425.4f, 5614.3f, 766.5f },
{"Strip Club DJ Booth", 126.135f, -1278.583f, 29.270f},
{"Blaine County Savings Bank", -109.299f, 6464.035f, 31.627f},
{"Police Station", 436.491f, -982.172f, 30.699f},
{"Humane Labs Entrance", 3619.749f, 2742.740f, 28.690f},
{"Burnt FIB Building", 160.868f, -745.831f, 250.063f},
{"North Yankton Bank", 5309.519f, -5212.375f, 83.522f},
{"10 Car Garage Back Room", 223.193f, -967.322f, 99.000f},
{"Humane Labs Tunnel", 3525.495f, 3705.301f, 20.992f},
{"Ammunation Office", 12.494f, -1110.130f, 29.797f},
{"Ammunation Gun Range",  22.153f, -1072.854f, 29.797f},
{"Trevor's Meth Lab", 1391.773f, 3608.716f, 38.942f},
{"Pacific Standard Bank Vault", 255.851f, 217.030f, 101.683f},
{"Lester's House", 1273.898f, -1719.304f, 54.771f},
{"Floyd's Apartment", -1150.703f, -1520.713f, 10.633f},
{"FIB Top Floor", 135.733f, -749.216f, 258.152f},
{"IAA Office", 117.220f, -620.938f, 206.047f},
{"Pacific Standard Bank", 235.046f, 216.434f, 106.287f},
{"Fort Zancudo ATC entrance", -2344.373f, 3267.498f, 32.811f},
{"Fort Zancudo ATC top floor", -2358.132f, 3249.754f, 101.451f},
{"Damaged Hospital", 356.822f, -590.151f, 43.315f},
{"Slaughterhouse", -80.557f, 6220.006f, 31.090f},
{"Los Santos County Coroner Office/Morgue", 243.351f, -1376.014f, 39.534f},
{"Torture Room",  147.170f, -2201.804f, 4.688f},
{"O'neil Ranch",  2441.216f, 4968.585f, 51.707f},
{"Main LS Customs", -365.425f, -131.809f, 37.873f},
{"Yacht", -2023.661f, -1038.038f, 5.577f},
{"Carrier (MP Only)", 3069.330f, -4704.220f, 15.043f},
{"Fort Zankudo UFO", 2052.000f, 3237.000f, 1456.973f},
{"Very High Up", -129.964f, 8130.873f, 6705.307f},
{"IAA Roof", 134.085f, -637.859f, 262.851f},
{"FIB Roof", 150.126f, -754.591f, 262.865f},
{"Maze Bank Roof", -75.015f, -818.215f, 326.176f},
{"Top of the Mt Chilad", 450.718f, 5566.614f, 806.183f},
{"Most Northerly Point", 24.775f, 7644.102f, 19.055f},
{"Vinewood Bowl Stage", 686.245f, 577.950f, 130.461f},
{"Sisyphus Theater Stage", 205.316f, 1167.378f, 227.005f},
{"Director Mod Trailer", -20.004f, -10.889f, 500.602f},
{"Galileo Observatory Roof", -438.804f, 1076.097f, 352.411f},
{"Kortz Center", -2243.810f, 264.048f, 174.615f},
{"Chumash Historic Family Pier", -3426.683f, 967.738f, 8.347f},
{"Paleto Bay Pier", -275.522f, 6635.835f, 7.425f},
{"God's thumb", -1006.402f, 6272.383f, 1.503f},
{"Calafia Train Bridge", -517.869f, 4425.284f, 89.795f},
{"Altruist Cult Camp", -1170.841f, 4926.646f, 224.295f},
{"Maze Bank Arena Roof", -324.300f, -1968.545f, 67.002f},
{"Marlowe Vineyards", -1868.971f, 2095.674f, 139.115f},
{"Hippy Camp", 2476.712f, 3789.645f, 41.226f},
{"Devin Weston's House", -2639.872f, 1866.812f, 160.135f},
{"Abandon Mine", -595.342f, 2086.008f, 131.412f},
{"Weed Farm", 2208.777f, 5578.235f, 53.735f},
{"Stab City",  126.975f, 3714.419f, 46.827f},
{"Airplane Graveyard Airplane Tail", 2395.096f, 3049.616f, 60.053f},
{"Satellite Dish Antenna", 2034.988f, 2953.105f, 74.602f},
{"Satellite Dishes",  2062.123f, 2942.055f, 47.431f},
{"Windmill Top", 2026.677f, 1842.684f, 133.313f},
{"Sandy Shores Building Site Crane", 1051.209f, 2280.452f, 89.727f},
{"Rebel Radio", 736.153f, 2583.143f, 79.634f},
{"Quarry", 2954.196f, 2783.410f, 41.004f},
{"Palmer-Taylor Power Station Chimney",  2732.931f, 1577.540f, 83.671f},
{"Merryweather Dock",  486.417f, -3339.692f, 6.070f},
{"Cargo Ship", 899.678f, -2882.191f, 19.013f},
{"Del Perro Pier", -1850.127f, -1231.751f, 13.017f},
{"Play Boy Mansion", -1475.234f, 167.088f, 55.841f},
{"Jolene Cranley-Evans Ghost", 3059.620f, 5564.246f, 197.091f},
{"NOOSE Headquarters", 2535.243f, -383.799f, 92.993f},
{"Snowman", 971.245f, -16

[swift-users] Strange behavior creating Double from String on Mac and Linux

2017-01-11 Thread Krystof Beuermann via swift-users

Hi Guys,

i just stumbled over this different behavior between Mac and Linux:

MacOS Sierra 10.12.1 Swift 3.0.2 REPL

 1> import Foundation
  2. let nf = NumberFormatter()
  3. print(nf.string(for: (Double("1")?.rounded()) as Any) as Any)
  4. print(nf.string(for: (Double("1")!.rounded()) as Any) as Any)

Optional("1")
Optional("1")

On Linux (http://swiftlang.ng.bluemix.net/#/repl/5876ac525784322e15d09920) the 
same code prints

nil
Optional("1“)


Is this a feature or a bug? Can anyone explain this?

Thanks for you help!

Krystof Beuermann___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] [swift-evolution] Best way to handle escaping function that might throw

2017-01-11 Thread Howard Lovatt via swift-users
Yes, I have used Result in the past.

In this case I wanted to use throws because that is what functions like map
do.

Looks like I will have to stick with throwing, not too bad since the
overhead is reasonably low.

On Wed, 11 Jan 2017 at 8:03 am, T.J. Usiyan  wrote:

> I suggest using an enum to represent success and failure. It's usually
> referred to as `Result`. It might seem weird for the closure that you
> presented as an example, since it would be Result, but it properly
> captures the possibility of having thrown.
>
> ``` swift
> enum UselessError : Swift.Error {
> case somethingBadHappened
> }
>
>
> enum Result {
> case success(T)
> case failure(Swift.Error)
>
> init(throwingClosure: (Void) throws -> T) {
> do {
> self = try .success(throwingClosure())
> } catch {
> self = .failure(error)
> }
> }
> }
>
> func burnItDown() throws -> Void {
> throw UselessError.somethingBadHappened
> }
>
> Result(throwingClosure: burnItDown)
> ```
>
>
>
> On Mon, Jan 9, 2017 at 10:28 PM, Jacob Bandes-Storch via swift-users <
> swift-users@swift.org> wrote:
>
> Moving to swift-users list.
>
> No, there's no way to do this today. The point of rethrows is that within
> one call site, "f(block)" can be treated as throwing if the block throws,
> or not throwing if the block doesn't throw. In your example, once the
> FStore object is constructed, the information about the original passed-in
> function is lost, so the caller has no way to know whether call() can throw
> or not.
>
> If this *were* possible, the information would somehow need to be encoded
> in the type system when creating FStore(f: block). That would require
> something like dependent typing, or generic-param-based-rethrows, e.g.
>
> struct FStore Void> {  // made-up syntax
> let f: T
> func call() rethrows(T) { try f() }  // throws-ness of this function
> depends on throws-ness of T
> }
>
>
>
> On Mon, Jan 9, 2017 at 9:21 PM, Howard Lovatt via swift-evolution <
> swift-evolut...@swift.org> wrote:
>
> Hi,
>
> If I have an escaping function that I store and then call, I need to
> declare the calling function as throwing, not rethrowing. EG:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> struct FStore {
> let f: () throws -> Void
> init(f: @escaping () throws -> Void) { self.f = f }
> func call() throws { try f() } // Can't put rethrows here - have
> to use throws
> }
> Is there a better solution?
>
> Thanks for any suggestions,
>
>   -- Howard.
>
>
>
>
>
> ___
>
>
> swift-evolution mailing list
>
>
> swift-evolut...@swift.org
>
>
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
>
>
>
>
> ___
>
>
> swift-users mailing list
>
>
> swift-users@swift.org
>
>
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
>
>
>
>
> --
-- Howard.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] [swift-evolution] Best way to handle escaping function that might throw

2017-01-11 Thread Howard Lovatt via swift-users
Another possibility, other than generics, would be to drop rethrows all
together and have the compiler infer if a throw is possible or not,
including:

struct FStore {
let f: () throws -> Void
func call() throws { try f() }
}

The compiler can make two versions, one if f can throw and one if it
definitely doesn't.

Just a thought.

On Tue, 10 Jan 2017 at 4:29 pm, Jacob Bandes-Storch 
wrote:

> Moving to swift-users list.
>
> No, there's no way to do this today. The point of rethrows is that within
> one call site, "f(block)" can be treated as throwing if the block throws,
> or not throwing if the block doesn't throw. In your example, once the
> FStore object is constructed, the information about the original passed-in
> function is lost, so the caller has no way to know whether call() can throw
> or not.
>
> If this *were* possible, the information would somehow need to be encoded
> in the type system when creating FStore(f: block). That would require
> something like dependent typing, or generic-param-based-rethrows, e.g.
>
> struct FStore Void> {  // made-up syntax
> let f: T
> func call() rethrows(T) { try f() }  // throws-ness of this function
> depends on throws-ness of T
> }
>
>
>
> On Mon, Jan 9, 2017 at 9:21 PM, Howard Lovatt via swift-evolution <
> swift-evolut...@swift.org> wrote:
>
> Hi,
>
> If I have an escaping function that I store and then call, I need to
> declare the calling function as throwing, not rethrowing. EG:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> struct FStore {
> let f: () throws -> Void
> init(f: @escaping () throws -> Void) { self.f = f }
> func call() throws { try f() } // Can't put rethrows here - have
> to use throws
> }
> Is there a better solution?
>
> Thanks for any suggestions,
>
>   -- Howard.
>
>
>
>
>
> ___
>
>
> swift-evolution mailing list
>
>
> swift-evolut...@swift.org
>
>
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
>
>
>
> --
-- Howard.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] for i in 0...UInt8.max

2017-01-11 Thread Quinn "The Eskimo!" via swift-users

On 11 Jan 2017, at 13:06, tuuranton--- via swift-users  
wrote:

> These codes used to crash in earlier Swifts. Can you explain why?

We now have the notion of `ClosedRange`, which can represent all values in an 
integer type (at the cost of introducing the complexity of two different range 
types).

You can find a bunch of info about this at the following links.









Share and Enjoy
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] for i in 0...UInt8.max

2017-01-11 Thread tuuranton--- via swift-users
I'm looking at Swift 3.0.1 now. This code works fine:
for i in 0..___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] CNLabeledValue var

2017-01-11 Thread German Laullon via swift-users
Thanks,

var toExcludeOrCopy : AnyObject?

Could help me on some cases...

But if I try this:

var props = [AnyObject]()
props += contact.phoneNumbers

( "contact" is as CNContact, so "contact.phoneNumbers" is
[CNLabeledValue]
)

I get this error:
/Users/laullon/xcode/bipo/BiPo/MergePreview.swift:82:21: Cannot convert
value of type '[AnyObject]' to expected argument type 'inout _'

With:
props.append(contentsOf: contact.phoneNumbers)

I get this error:
/Users/laullon/xcode/bipo/BiPo/MergePreview.swift:83:33: Extraneous
argument label 'contentsOf:' in call

Any Idea?

Germán Laullón


On Tue, Jan 10, 2017 at 12:36 AM, Hooman Mehr  wrote:

> Ouch!
>
> This is a side effect of ObjC lightweight generics being imported as Swift
> generics in Swift 3.0.
>
> Since there is no common superclass that satisfies NSCopying &
> NSSecureCoding and the fact that NSSecureCoding has static requirements
> means you can’t do it (at least without hacks such as extending NSObject to
> conform to both protocols or creating a wrapper class and creating a
> non-generic subclass of CNLabeledValue and using it instead).
>
> For now, you have to use
>
> var toExcludeOrCopy : AnyObject?
>
> This is worthy of a bug report and points to a serious issue: The
> “limitations” that result from importing ObjC lightweight generics as Swift
> generics. One possible solution can be implementation of “Enhanced
> Existentials
> 
> ”.
>
>
> On Jan 9, 2017, at 11:23 AM, German Laullon via swift-users <
> swift-users@swift.org> wrote:
>
> Hi All
>
> I just upgrade to Swift 3. After open and convert my codes I found lots of
> errors. One of them is about CNLabeledValue.
>
> With Swift 2.3, it works well with:
>
> var toExcludeOrCopy : CNLabeledValue?
>
> With Swift 3, it gives me the error message:
> Reference to generic type 'CNLabeledValue' requires arguments in <...>.
>
> After I fixed it with XCode, it changed to:
>  var toExcludeOrCopy : CNLabeledValue?
>
> However, Xcode gives me error message with this fix:
> Type 'AnyObject' does not conform to protocol 'NSCopying'.
>
> I know the error is because of the generic type but I don't know how to
> declare with CNLabeledValue. My purpose is to store any the CNLabeledValue
> including phone number, email, address etc to one var.
> Any help will be appreciate.
>
> Germán Laullón
>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
>
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] C-function not found by linker

2017-01-11 Thread Rien via swift-users
Sometimes you just have to post a stupid question to see what you did wrong :-(

So please disregard….


PS: it was of course the “static” (I have no clue why I did put that in there… 
oh well)

Regards,
Rien

Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Swiftrien
Project: http://swiftfire.nl




> On 11 Jan 2017, at 10:28, Rien via swift-users  wrote:
> 
> My project uses openSSL and that works fine.
> 
> I needed one specific function that cannot be accessed from Swift directly, 
> so I created a C-file for that. (both .h and .c file)
> 
> The function is found during compilation.
> 
> But is then reported as “unused” and the linker reports “missing function”.
> 
> Any idea’s how this can be caused?
> 
> More info:
> 
> The .h file:
> 
> static void sslCtxSetTlsExtServernameCallback(SSL_CTX *ctx, int (*cb)(SSL *, 
> int *, void *), void *arg);
> 
> The .c file:
> 
> static void sslCtxSetTlsExtServernameCallback(SSL_CTX *ctx, int (*cb)(SSL *, 
> int *, void *), void *arg) {
>SSL_CTX_set_tlsext_servername_arg(ctx, arg);
>SSL_CTX_set_tlsext_servername_callback(ctx, cb);
> }
> 
> Regards,
> Rien
> 
> Site: http://balancingrock.nl
> Blog: http://swiftrien.blogspot.com
> Github: http://github.com/Swiftrien
> Project: http://swiftfire.nl
> 
> 
> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] C-function not found by linker

2017-01-11 Thread Rien via swift-users
My project uses openSSL and that works fine.

I needed one specific function that cannot be accessed from Swift directly, so 
I created a C-file for that. (both .h and .c file)

The function is found during compilation.

But is then reported as “unused” and the linker reports “missing function”.

Any idea’s how this can be caused?

More info:

The .h file:

static void sslCtxSetTlsExtServernameCallback(SSL_CTX *ctx, int (*cb)(SSL *, 
int *, void *), void *arg);

The .c file:

static void sslCtxSetTlsExtServernameCallback(SSL_CTX *ctx, int (*cb)(SSL *, 
int *, void *), void *arg) {
SSL_CTX_set_tlsext_servername_arg(ctx, arg);
SSL_CTX_set_tlsext_servername_callback(ctx, cb);
}

Regards,
Rien

Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Swiftrien
Project: http://swiftfire.nl




___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users