I’ve a cocoapods library.
- This library has some C features that I’ve uncovered globally:
#outline EXPORT __attribute__((visibility("default"), used, retain)) extern "C"
EXPORT void ios_prepare_request(const char *url) {
// some obj-c code
}
- Then internally a dylib is loaded. This dylib tries to name these features.
- When run through Xcode, every little thing is working.
- Nevertheless, once I package deal the app to TestFlight/Debugging deployment. There’s a stripping step that removes my world symbols. Subsequently when I attempt to name any of the features from the dylib in some unspecified time in the future it will get a null pointer reference and the app crashes.
- I have been attempting to get round this with the assistance of one of many apple engineers, his suggestion is to make use of a linker flag -export_symbols_list, however it doesn’t matter what I attempted it does not work.
- I’ve managed to get it working by disabled world stripping within the consumer goal xcconfig, however this clearly shouldn’t be ultimate because it messes with the consumer goal.
s.user_target_xcconfig = {
'STRIP_STYLE' => 'non-global'
}
- By default cocoapods creates a static lib, so export_symbol_list will not work as it’s meant for dylibs, I attempted to unravel this by turning the lib right into a dynamic framework
s.static_framework = false
s.preserve_paths="exports.exp"
s.pod_target_xcconfig= {
# 'OTHER_LDFLAGS' => '$(inherited) -Wl,-exported_symbols_list,$(PODS_TARGET_SRCROOT)/exports.exp',
}
- With the default config an a static lib, claude suggests utilizing a
-u
flag and passing every image I must maintain alive, however this additionally doesn’t work
s.user_target_xcconfig = {
'OTHER_LDFLAGS' => '$(inherited) -Wl,-u,_ios_prepare_request'
}
At this level I am out of concepts how you can stop the worldwide symbols from being stripped. Sooner or later I attempted passing the features in a initialization perform however by some means they have been nonetheless being stripped.
Any strategies what may work?