I don’t know how C API is imported, btus INOUT parameter must be mutable, this 
is a language artifact.


Am 16. Januar 2018 um 22:10:13, Rick Mann via swift-users 
(swift-us...@swift.org) schrieb:

Is it not possible for Swift to treat C API const pointers as something that 
can take let arguments?


LGS_EXPORT bool lgs_notify(struct lgs_context_t* ctx, const 
lgs_notify_params_t* params);
.
.
.
let p = lgs_notify_params_t(...)
lgs_notify(self.ctx, &p)
^Cannot pass immutable value as inout argument: 'p' is a 'let' constant


Why isn't the "const" in the C declaration enough to let Swift know it's const 
and just allow it to be a let?

--  
Rick Mann
rm...@latencyzero.com


_______________________________________________
swift-users mailing list
swift-us...@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to