C++ code in iPhone app


C++ code in iPhone app



I'm trying to use a C++ library (CLucene) from my Cocoa Touch iPhone application using Xcode 3.1.3. Everything works fine when I run in the iPhone simulator, but things get strange when I run on device. It seems like pointers aren't being passed correctly from the Objective-C++ code (my app) to the C++ library (CLucene).

While debugging the app on device, I can watch a const char* variable passed as a parameter to a C++ function change from 0x12546c0 in Objective-C++ to 0x4e in C++. Since 0x4e doesn't point to a valid const char*, the C++ code fails. This doesn't happen when debugging in the simulator.

I'm compiling the C++ library directly into the app, not linking to a static or dynamic lib.

Any help would be much appreciated.


Memory management and performSelectorInBackground:

1:

tableView footer strange behavior
Disabling "Compile for Thumb" in the project's build settings fixes the problem.. Truly modal UIAlertView in iPhone?
MVC and the communication between them. What did i miss?Accessing GPS on Blackberry using Javascript and sending lat/long values to a server via url

2:

What is something you wish you had known sooner about the iPhone SDK?
There should be no problem using C++ code in an iPhone App (I did it all the time).. How do I center a UIImageView within a full-screen UIScrollView? Pointers should just be passed as pointers without any interpretation.
Are you sure the Objective-C++ object is a 'const char*' and not any another type this is being converted (incorrectly) into a 'const char*' on the fly at run-time?. SSLHandshakeException unknown_ca apns java


94 out of 100 based on 39 user ratings 354 reviews