I have an iOS app that uses a few C++ static libraries. I use the -force_load
option to ensure that my C# interop calls can find and use the static library entry points.
It seems like Xamarin is a bit overzealous when it goes to link-all for release builds. When I set the Linker behavior to Link all assemblies, my release builds cannot call into my static libraries while my debug builds can.
I added a few -v
flags to the Additional mtouch arguments field and saw this line after the final link for release:
/usr/bin/strip -i -s "/path/to/my/app/obj/iPhone/release/mtouch-cache/Build/symbol-file" "/path/to/my/output/directory/MyApp.app/MyApp"
When I use nm -m
on the resulting binary, I don't see my static library entry points for my interop calls.
Looking at the symbol-file
, I see a few mono names (eg, _monotouch_release_managed_ref
, _monotouch_create_managed_ref
, and friends), and it seems like if a library needs to be force-loaded, its symbols should be in this file so that they're not stripped immediately after.
How can I keep the static library symbols that I need to force load?
- Do they need to be in the
symbol-file
? What do I do to ensure that happens? - Should Xamarin inspect force_load libraries and add their external symbols to the
symbol-file
?