Re: Mixing Objective C and C++
Re: Mixing Objective C and C++
- Subject: Re: Mixing Objective C and C++
- From: Shawn Erickson <email@hidden>
- Date: Tue, 25 Jan 2005 12:32:44 -0800
On Jan 25, 2005, at 11:51 AM, Bert Torfs wrote:
Hi all,
I am writing a program where the model is written in C++ (legacy), the view in Objective C and the controller something in between. Every C++ object has an objective C counterpart that acts as a pass-thru to its methods. These objects are created and released as needed. I have not touched the C++ objects until now.
For performance, I added an instance variable to every C++ object that holds its Objective C counterpart. But now simple things like
<x-tad-smaller> double theAmount;
theAmount = currentDebit->localBalance();
</x-tad-smaller>do not work anymore. While localBalance equals 91797.283316716232, theAmount equals -6.9988350839989206e-268 after the function call.
(the method 'localBalance' does nothing but returning localBalance.).
Any idea?
Ignoring the problematic use of floating point numbers for what appears to be currency...
Are you working with serialized C++ objects that when unserialized may not reflect the changes you made to the classes when you added the references out to the Objective-C object?
Did you rebuild everything? The vtable may be screwed up and your localBalance() call may be hitting a different a different method (unlikely that link errors wouldn't have been hit but who knows if you have some type of mixed object code). Try deleting the build directory and rebuilding things.
Showing code would help...
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden