There are a bunch of challenges here but the one you need to solve first is defining a Swift equivalent of the UplinkRef
C structure. What you’re currently doing is not valid because it relies on Swift and C structs laying out the same way, and that’s not something we guarantee [1]. Right now, the only way to get a Swift struct that lays out the same way as a C struct is no import the struct from C.
As with your earlier thread, I recommend that you start by putting these C declarations in a bridging header. That will allow you to get your dynamic loader code working. Once you have that sorted out, you can tackle the problem of making these declarations available in your SPM setup.
Share and Enjoy
Quinn “The Eskimo!” @ DTS @ Apple
[1] Admittedly, for a struct with a single integer member there’s limited scope for problems, but it’s best to start out on the right path.