Hello again ![]()
I’m trying to introduce memory safety to my Swift project which integrates some C functions. For this I referred to this WWDC session
Unfortunately the __noescape annotation is not being recognized at all by the compiler. By using __attribute((__noescape__)) I can proceed and the __counted_by(N) annotation is actually recognized (on macOS).
The problem is that on the Swift side the expected function signature containing Span as parameter is not produced. I still get the same old UnsafePointer as before.
For context the function I’m trying to integrate has the following signature:
int ecdsa_signature_parse_der_lax(secp256k1_ecdsa_signature* sig, const unsigned char *__counted_by(inputLen) input __attribute((__noescape__)), size_t inputlen);
For further context here’s a pull request with the attempted change to the project. I’m using Swift 6.2 and the latest Xcode of course. The failed check also shows how on Linux it doesn’t even recognize the __counted_by(N) annotation (missing C language extension?).
I’m even using the latest available C2x draft standard for the library but that doesn’t seem to make a difference. Also not sure how to enable the bounds safety language extension from the package manifest.
Anyway whatever insight anyone can provide I will appreciate! I’m aware of the possibility of this being yet another feature showcased but not delivered ![]()
Thanks in advance!