My iOS project uses dlsym
to dynamically point to an optional C library. Optional as-in the project can run with our without it, it just adds features.
For background info: Detect and use optional external C library at runtime in Objective-C
The problem is, XCode cleans up libraries that are "not used". Using dlsym
means there are no direct references to my 3rd party library and XCode removes it.
I thought I found a solution, in "Other Linker Flags" I added
-force_load "$(SRCROOT)/my_external.a"
which worked great in the simulator. (-all_load
works fine too but seemed overkill to me).
The problem is when I moved to a real device, this workaround failed and the library is not loaded (same thing with -all_load
).
The only thing that worked was to disable in XCode the feature called Dead Code Stripping
.
Question is: is it really bad to disable or recommend my customers to disable this feature? If so, is there a better alternative?
is it really bad to disable or recommend my customers to disable this feature?
Are the customers expected to build the programs themselves? If so I would say that the customer in this case is also a developer. Therefore I don't see a problem on giving developer instructions on how to build the program within the supported build environment (XCode). – Verlinevermeer