Converting an old C library from static to dynamic

I'm trying to build a dynamic version of an old C static library. The static library, as it stands, references symbols which are defined in the program the static library is bound to. When I try to build this as a dynamic library I get:

ld: symbol(s) not found for architecture x86_64

messages. I suspect there is a way to work around this (weak references?) but I don't understand how to do it, and none of the online documentation and commentary I have found seems to help.

Does anyone have suggestions to offer?

Replies

The static library, as it stands, references symbols which are defined in the program the static library is bound to.

That’s tricky to resolve because Apple platforms use a two-level namespace; see An Apple Library Primer for a quick intro to that concept.

The best way to resolve this is to carefully layer your code to put the symbols needed by this dynamic library into a separate dynamic library. Once you do that, you can import that library into both this dynamic library and your main program.

Is that feasible in your case?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for the quick reply. I think I need to discuss this with the lead developer.