Googling around, I found several blog entries, some old and no longer valid it seems, that attempt to explain how to use a C library from Swift. Doing so appears to involve a lengthy process or creating a wrapper and a bunch of files.
However I just want to use a single C function, not a library, and I'm coming at this from the point of view that Swift Should Do It Right, instead of the alternative position that Swift Should Be Unnecessarily Complex.
Therefore I am wondering why all this wrapper business is even necessary. Is there perhaps a simpler, more minimalist way to call a C function from Swift? Suppose I don't even have a library, I have just a .c file or its compiled .o file.
I just need to
- tell swiftc what the prototype for the C function is.
- call the function from Swift
- link these on the command-line.
How to do that?