Note that there are some explanatory texts on larger screens.

plurals
  1. POWrapping a C++ library in Objective-C is not hiding the C++ symbols
    text
    copied!<p>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, <em>libulrt.a</em>. To get my project to compile I set the path to the <em>User Header Search Path</em> to point to the directory where the C++ header files are located. I then had to set <em>compile source as</em> to <em>Objective-C++</em>.</p> <p>The problem now is that, although the wrapper library compiles correctly, once I include it in another Xcode project I have to <strong>again</strong> set <em>compile source as</em> to <em>Objective-C++</em> 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 <em>implementation</em> (*.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 <em>compile source as</em> set to <em>Objective-C</em>. Anyone got any ideas how to do this? </p> <p>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!)</p> <pre><code>"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) </code></pre> <p>The header file for my wrapper library is as follows:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; @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 </code></pre> <p>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?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload