Consider the following Cocoa project structure:
Host
|-- LoadablePlugIn
| |-- Main.storyboard
| |-- Info.plist
| |-- TDWLPIClassOne.h
| |-- TDWLPIClassOne.m
| |-- TDWLPIClassTwo.h
| |-- TDWLPIClassTwo.m
|-- TDWAppDelegate.h
|-- TDWAppDelegate.h
|-- TDWClassOne.h
|-- TDWClassOne.m
|-- TDWUtils.h
|-- TDWUtils.mm
|-- Base.lproj
| `-- Main.storyboard
|-- Info.plist
`-- main.m
Here the root folder refers to sources of the Host target (the main executable target), while LoadablePlugIn refers to resources of an embedded plug-in target with corresponding name. Both targets at the same time want to use TDWUtils symbols for their own purposes, so I add TDWUtils.mm to compile sources of both Host and LoadablePlugIn targets. It compiles and works without issues, however since the LoadablePlugIn is supposed to load during run-time the linker is not able to locate duplicated symbols of TDWUtils.mm in the binaries and I’m not sure if that is a robust scenario:
...
Class plugInPrincipalClass = [NSBundle bundleWithURL:loadablePlugInURL].principalClass;
NSWindowController *windowController = [plugInPC instantiateInitialController];
...
Should I compile LoadablePlugIn with hidden symbols compiler flag (like -fvisibility=hidden) or use any other technique to prevent the name collision or can I just leave it as is because in both binaries the symbols of TDWUtils have exactly the same implementation?