P/Invoke Swift code from C#

Hi, is it possible to call compiled Swift-Code compiled with "swift for windows" from C#, e.g. via P/Invoke?

Its not really "swift for windows" so much as Swift. That said, no, it is not possible to call Swift code from C# via P/Invoke. The calling convention would not be supported by the CLR. You could do some heroics to accomplish this, but it isn't entirely supported to do so. The lingua franca for FFI is C, which you should be able to use to bridge between C# and Swift.

Terms of Service

Privacy Policy

Cookie Policy