I am trying to wrap a C++ library (for Sybase Ultralite) with Objective-C so that the library can be imported into MonoTouch. I have created an Objective-C library and included the compiled C++ library in this project, libulrt.a. To get my project to compile I set the path to the User Header Search Path to point to the directory where the C++ header files are located. I then had to set compile source as to Objective-C++.
The problem now is that, although the wrapper library compiles correctly, once I include it in another Xcode project I have to again set compile source as to Objective-C++ otherwise the project consuming my wrapper library gives linking errors. I don't understand why this is, because the header file for my wrapper library contains only Objective-C code and not C++ code at all. C++ code is only found in the implementation (*.mm file) of the wrapper library. What do I need to do to make the C++ implementation completely transparent to the project consuming the wrapper library? In other words, I want to be able to include my wrapper library and compile with compile source as set to Objective-C. Anyone got any ideas how to do this?
The linking errors that I am getting when compiling the project consuming my wrapper are as follows: (I have abridged the error listing because it is LONG!)
"operator delete(void*)", referenced from:
zc3db40339fee::~zc3db40339fee()in libUltralite.a(ee39bf4763.o)
zb4297ee7d543::~zb4297ee7d543()in libUltralite.a(747e80fdad.o)
z33836a0a6f46::~z33836a0a6f46()in libUltralite.a(f240efda30.o)
"___cxa_pure_virtual", referenced from:
vtable for ze78b0ec59364in libUltralite.a(2c50e8e8ff.o)
vtable for ze78b0ec59364in libUltralite.a(2c50e8e8ff.o)
vtable for ze78b0ec59364in libUltralite.a(2c50e8e8ff.o)
The header file for my wrapper library is as follows:
#import <Foundation/Foundation.h>
@interface DataAccess : NSObject {}
// Release objects.
- (void)dealloc;
// Singleton instance of the DataAccess class.
+ (DataAccess*)sharedInstance;
// Finalize the Database Manager when done with the DB.
+ (void)fini;
// Adds the given name to the database.
- (void)addName:(NSString *)name;
@end
Anyone have any idea how I can compile this as Objective-C++ but still have the projects consuming this library see it as Objective-C?