3

In the quest to resolve the Objective-C namespace issue I'd like to experiment with prefixing a dependency's Objective-C classes based on the target being built.

As an example, suppose I have in my shared library (ObjCStaticLib) a class (CWindow). I have two plugins (A and B) that will use this CWindow. To avoid A's CWindow from colliding with B's CWindow, I want to prefix the CWindow class name at compile time, so A's CWindow becomes ACWindow and B's becomes BCWindow.

I'm looking for a way to communicate to ObjCStaticLib at compile time what prefix it should use to compile itself with. I'm thinking about using xcconfigs to specify a preprocessor macro that the leaf target customizes and that ObjCStaticLib uses. However, I'm not aware of a way for a target to "communicate" with a dependency like that.

I can modify all the sources/projects/etc involved as necessary to implement per-client namespace customization in a dependency.

Does anyone have a good solution for this?

Community
  • 1
  • 1
fbrereto
  • 35,429
  • 19
  • 126
  • 178
  • Can you describe your preprocessor idea a bit further? – nall Sep 26 '09 at 02:01
  • That's why Apple's frameworks begin with AWindow and BWindow, not a generic CWindow. In short, if you have two static libs, you can't do this. I'm not answering this as an answer since experience suggests it'll be voted down, not because it's inaccurate but because you won't like the fact that it's not possible. So I'm leaving it as a comment here for informational purposes only. – AlBlue Sep 26 '09 at 07:23

0 Answers0