I am building an .xcframework which contains an iphonesimulator and iphoneos frameworks. There is some Swift code, and some C++ code, which is linked into a shared object (Mach-O 64-bit dynamically linked shared library arm64). I build my C++ with -fvisibility=hidden
, and only the symbols that I explicitly mark, are exported. But, when I run nm -gC
, I see all kinds of symbols that are still there – and they are visible even in the iOS app that is built using this framework. For example, I have an inner class Secret
(it is only used in one cpp file). And nm -gC
shows me (and all hackers out there)
00010292 t Secret::getString() const
Is there a way to hide this and other sensitive information?
And, on the other hand, how can I keep the auto-generated _AlexSDKVersionNumber
exported?
You should configure your project settings correctly for Stripping to hide internal names.
Go to Your target
> Build Settings
> Deployment
:
Set Deployment Postprocessing
to YES
to enable Stripping.
Set Strip Style
to Non-Global Symbols
.
Now nm
should provide global (external) symbols only for your binary.