Re: crashes after changing signatures of virtual functions / virtual inherited classes
Re: crashes after changing signatures of virtual functions / virtual inherited classes
- Subject: Re: crashes after changing signatures of virtual functions / virtual inherited classes
- From: Chris Espinosa <email@hidden>
- Date: Thu, 3 Aug 2006 10:32:42 -0700
On Aug 3, 2006, at 9:03 AM, Stephan Huber wrote:
I am experiencing crashes in my code at various places after editing headerfiles of classes which have virtual functions, or where one of their base-classes are virtual inherited. This occurs, if I add, remove or change a virtual function signature.
Calling the modified virtual function leads to a crash, for example inside dynamic_cast, or inside the newly added virtual function or only the base-class's function is called, not the inherited function.
So something went wrong with the object's vtable.
If I clean the project completely and recompile everything, everything works stable and as expected, so there must be something bogus when compiling / linking changed code.
Most of the objects are created by an object-factory which register for every objecttype a template-object, which returns a newly created object.
I am bit stuck for now, I am not an xcode/gcc expert to narrow down the problem, my code works fine on Visual c++, so does anybody has an idea of what is going wrong? (cleaning and rebuilding the whole project is not an option)
This usually indicates a mismatch between a library and its client, which in turn implies that when you changed the header for a library that the client application wasn't rebuilt.
The general way to set this up is to ensure that the application target has a dependency on the library target, and then build and run the application. This should cause the library to be built and re-linked into the application.
Another possibility is that at launch time the app is picking up the older copy of the library, even though the newer copy is built. We'd have to know more about your setup to diagnose this further, but there are some basic recommendations:
1) Use a common build folder for both the library and the app
2) Launch the app from inside Xcode; when you do, the build folder is automatically patched into the library search path to pick up the latest library
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden