So want to create a dynamic swift library containing multiple modules. In my Package.swift
it looks like this:
.library(
name: "MyLib",
type: .dynamic,
targets: [
"MySwiftTarget",
"Cmyctarget"
])
I'm able to build this product just fine with swift build --product MyLib
, however when I try to link against it, I get the following error:
error: missing required module 'Cmyctarget'
This is when I try to build and link manually using swiftc:
swiftc -swiftc -I. -L. -lMyLib foo.swift
So I have tried to reproduce this in the simplest possible case, and it seems like it's not reproducible. I'm at a bit of a loss trying to figure out how to debug this, so I am wondering:
-
is there any way to get information about which modules are contained in a dynamic library build using SPM? It would be extremely helpful if I could take a look at the contents of my .so as it's viewed by SwiftC to try to understand where the problem is occuring..
-
How are the interfaces defined for a dynamic library containing multiple modules? In a C project, I would expect to have an
include
directory somewhere with all the header files which would have to be included in the-I
argument for the compiler. But what's the equivalent here? Do I have to include the include paths from my C language source directories individually, or does that get sorted out somehow by the compiler?