How can I do dynamic lookup in my framework similar to iOS SDK framework weak linking.

I have a framework and want to add a feature which will call another library if it is present during runtime (eg. linking to the application binary). And because of the size of that library which kind of big and I want to enable this feature based on my client (consumer of my framework) so I tried to do a weak linking behavior similar to iOS SDK frameworks and checking for the library at runtime.


I tried many ways but all of them have some downsides so I want to know if there's a way to mimic the iOS SDK frameworks weak linking.

These are the ways that I tried

1. Use linker flags -Wl, -U on every external library's symbols but this way make my framework's incompatible to Bitcode.

2. Use "-undefined dynamic_lookup" linker flag but there is a warning says that "-undefined dynamic_lookup is deprecated on iOS" which make my framework be able to break in the future.

3. Provide another target that linking to that library but I have to provide a way to allow my Framework to link with a dependecy outside of my project.


After considering these options, I think the most seamless way to do is the way Apple's using for their iOS SDK frameworks but I don't know how to do it. Anyone has any tip or suggestion on how to achieve this?

How can I do dynamic lookup in my framework similar to iOS SDK framework weak linking.
 
 
Q