krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
907 stars 334 forks source link

code which previously worked with Cocoapods OpenSSL doesn't compile when using SPM #130

Closed wtholliday closed 2 years ago

wtholliday commented 2 years ago

I'm getting errors like:

Cannot find type 'X509' in scope

(X509 is defined in ossl_typ.h)

Example project to reproduce the error is attached.

ReceiptTest2.zip

wtholliday commented 2 years ago

Seems this is due to OpenSSL switching to using opaque pointers:

https://forums.swift.org/t/opaque-pointers-in-swift/6875

So types like X509* become an OpaquePointer in Swift.

krzyzanowskim commented 2 years ago

exactly. this is due to how Swift import some macros. I Did add https://github.com/krzyzanowskim/OpenSSL/blob/master/shim/shim.h at some point. If you feel adventurous you're welcome to generate X509* functions for Swift - that's mostly woodwork though.