Dynamic Linking within a Single Package

packagemanager

(Jeremy David Giesbrecht) #1

Is there a way to make a package target depend on a dynamic library product in the same package?

It doesn’t seem to be able to find the products in the same package, even when declared explicitly: .productItem(name: "LibraryProduct", package: "ThisPackage").

Depending on the corresponding targets instead compiles fine, but then nothing is linked dynamically.

What I want to do is have two executables share code in a library, and have all three in one package, thereby reducing the binary size of the two executables. Right now though, adding the library product just causes its content to duplicated an additional time, bringing it to three copies of the same binary content.