Yup, thanks Matt, indeed it only seems like the template function had the problem, not regular functions. I'm pretty sure our intermediate files build to different locations as well. A guy here actually just noticed that making the template function static also seemed to avoid the problem in case that is useful.
Thanks guys.
Micah
On May 22, 2007, at 10:19 AM, Matt Rhodes wrote: On May 22, 2007, at 9:47 AM, Micah Sharp wrote: I recall we were told that with Objective-C we needed to have unique class or interface names, but does this hold true for functions as well?
We have 3 plugins that all share a templated function, and it REALLY seems like one plugin is calling the function compiled a 2nd plugin. We think this because, if we add "return 0" at the top of the function, but only rebuild one plugin, the code still executes! If we rename the function to something unique, then it correctly returns 0 and does nothing. Another interesting thing is we had been having problems stepping into the code to debug, but after the rename, it suddenly has no problem at all.
Is that possible?
Micah, The problem we talked about is only with Objective-C class names. It doesn't affect method names, as those are always resolved at runtime in Objective-C, and it doesn't affect C or C++ function, method, or class names, as they are resolved at compile or link time. However, you can still run into a problem that looks like the same thing, but isn't, with C or C++. I believe what's happening is that the linker is finding an older version of the library containing templated method your code is calling. If you do a full clean and rebuild of your filter, you'll probably find that it works correctly. I think this occurs when you have 1 directory that you put all of your intermediate files into, regardless of the project that they belong to. But I'm not positive. Do you have your project set up to output intermediate files to some common directory that is shared with other projects? You might ask on the xcode user's list, too. I know this has come up before. You can sign up here:
But basically, it's an Xcode configuration issue, and not a language problem, as far as I know.
Darrin
Hi Micah.
I'll have to check Darrin's suggestion, but I'm pretty sure we compile each project into separate directories.
We had to make each templated C++ class have a unique name.
For example, we have 2 FxPlugs: Stackwerks and 3D Flag. These FxPlugs share a zxArray class (which is a template).
We had to make the name "zxArray" unique for the two FxPlugs.
We do it with the following at the top of our zxArray.h: #ifdef FLAG #define zxArray zxArrayClassFL #endif
#ifdef STACKWERKS #define zxArray zxArrayClassSW #endif
We had to do this for all of our template C++ classes.
Our code would react the same as yours did until we did this. Now things work just fine.
Note that we only had to do this with our template classes -- not regular C++ classes.
I don't know if this is the only solution, but it works for us.
Matt Rhodes Zaxwerks, Inc.
|