Swiftc to executable

I'd love to see some documentation on the various files swiftc produces and what they're used for. Might be something wrong with my browser but I don't seem to be able to get anywhere near this from the swift.org documentation link.

It's no use to tell me about package manager, I don't have it. Minimal 5.9 build on the Haiku platform, ELF 64 bit. I would eventually want to wrap C++ classes with callbacks dispatching into Swift code off of POSIX threads, so documentation is bound to come in handy somewhere along the line.

At the moment I'm able to make a static executable from multiple files, but have no idea why each module has to be a .a library, or if it really does - swiftc seems happy to produce a .o file with what look like the symbols, but no joy here. Who uses .swiftmodule, .swiftdoc, .swiftsourceinfo? Etc. -- don't go to any trouble to explain, because I probably don't need all that right now and will just forget where I saw it, it's just the type of thing I'm sure is documented somewhere.

Thanks!

1 Like

You'd be surprised, a lot of that is barely documented. A grep of the doc files turned up these two, you could probably find a few more snippets here and there.

How are you building this, natively or cross-compiling? How much did you have to patch it?

1 Like

Thanks, I think that should help a great deal to get started.

Someone else did this port. He may eventually turn up with more like a distribution than this, I hope so, but it is what it is. It builds native, includes llvm. There are patches that reportedly have been "upstreamed", and for all I know one could start at the top and build a distribution.

Not sure about .swiftsourceinfo, but AFAIK .swiftmodule, .swiftdoc and .lib are used if you build a dynamic library and use it as a Swift module which you can import in any Swift app.

Update: .swiftsourceinfo is probably for the same purpose and is needed to enable debugging when source code of your compiled module is not available, but this is only my guess.

Sorry for the reply then :roll_eyes:

As long as you didn't go to any real trouble, there's no harm! Thanks.

1 Like