Enabling Static Linking on Windows

That I am less certain about. I don't think that the LSP uses the swiftmodule to provide completion but rather relies on the source indexing to provide that. I might be completely wrong on that part, but without teaching SK-LSP about deserialising the swiftmodule, I don't think that it would provide completion.

CC: @ahoppen

Yeah, I thought so. That defeats the whole purpose of static libs.
Is there any other way to link to my engine code without having to see the sources ?
Currently, I am building a dynamic lib and declare all public engine APIs with _cdecl which isn't really optimal.

You do not need to see the sources to link to the code. But you will need that for the completion through SourceKit-LSP. You could generate documentation and ship that along with the libraries to enable the use of the library.

Yes, a .swiftmodule should be sufficient for code completion purposes. Code completion shouldn’t be affected by static vs. dynamic linking though.

Does this also hold true for windows ?

Yes, I don’t know any reason why it should not. All SourceKit functionality happens at a stage that’s before linking.

1 Like