Export Symbol File: Objective-C Objects, 64-bit

I have a Cocoa-based universal dynamic library that also includes more static libraries from which I want to export functionality. It seems I can not do the latter without using the export symbol file, and this is good for me ... somehow. I’m not using the option “Symbols hidden by default” (GCC_SYMBOLS_PRIVATE_EXTERN, -fvisibility = hidden). The problem arose when I tried to export the base class from a dynamic library, more specifically, trying to use its members in derived classes not included in the library, and even more specifically in the 64-bit assembly: "Undefined characters:" _OBJC_IVAR _ $ _ PluginBase. fConn "" I am aware of 64-bit changes: http://developer.apple.com/library/mac/#releasenotes/Cocoa/RN-ObjectiveC/_index.html , section "64-bit Class and Instance Access Control"

And, of course, everything works if I add _OBJC_IVAR _ $ _ PluginBase.fConn to the export file ... but only for 64-bit assembly, 32-bit does not know about such things: "Undefined characters:" _OBJC_IVAR _ $ _ PluginBase .fConn "referenced: -exported_symbol [s_list] command line option"

The only solution seems to be another workaround: to have two export files. But ... I can’t use the "Add Build Setting" for the EXPORTED_SYMBOLS_FILE: -S parameter.

Any ideas (other than using public access methods)?

+4
source share
1 answer

You can configure architecture build options using xcconfig files. It seems like this is not possible in the GUI. Create an assembly configuration file containing the following:

EXPORTED_SYMBOLS_FILE[arch=i386]=$(SRCROOT)/SymbolsList32Bit EXPORTED_SYMBOLS_FILE[arch=x86_64]=$(SRCROOT)/SymbolsList64Bit 

and then in the project settings, set this file as the build configuration for the project, and you should be good to go. (Obviously, you will need to specify the paths to your files, but I hope you get this idea.)

It worked for me. (FWIW you can also conditionally determine the name of the SDK, for example MY_SETTING [sdk = iphoneos *] = FOO, MY_SETTING [sdk = mac] = BAR, etc.)

Hope this helps!

+1
source

Source: https://habr.com/ru/post/1386782/


All Articles