blobichon
blobichon

Reputation: 23

Use existing DLL in iOS app through mono framework

For one of my current iOS project, some business logic has been provided to me through a DLL and Native C++ binding code that i have to recompile in a dynamic library (dylib) and then use the DLL through this dynamic library. Finally the DLL is used like this example:

int main(int argc, char** argv){
  RTEnvironnement::CreateRTEnvironnement("../dll/RT.dll");
  RT::RT_Facade *  mFacade = new RT::RT_Facade();
  RT::RT_Data_Projet *  mProjet = new RT::RT_Data_Projet();
  mProjet->Load_From_XMLFile(argv[1]);
... 

Objects RTEnvironnement, RT_Facade, RT_Data_Projet are provided by the binding C++ dynamic lib. I cannot get the code of the base DLL and i have to use the DLL as it is on IOS.

I'm currently studying if mono touch can able my IOS app (basic iOS Objective C based on Xcode ), to launch the DLL that as been build with the standard mono framework. Before purchasing a license, I have to be sure that MonoTouch is able to do this.

Is someone do something similar ? Is there a simplest way to this ? If i choose to use MonoTouch, can i keep my project in Xcode and just build the dylib in MonoDevelop and then import the lib the Xcode project ?

Thanks for your help.

Upvotes: 2

Views: 1599

Answers (1)

poupou
poupou

Reputation: 43553

the DLL that as been build with the standard mono framework.

MonoTouch (like Mono for Android) provide a base class library (BCL) profile that is similar (a superset) to Silverlight. However it's a subset of the whole Mono framework.

As such it's very common that assemblies compiled against the full framework won't work on MonoTouch unless they are re-compiled (against the MonoTouch BCL).

If i choose to use MonoTouch, can i keep my project in Xcode and just build the dylib in MonoDevelop and then import the lib the Xcode project ?

It's more complicated than that (e.g. MonoDevelop won't give you a .dylib). You might be able to google some instructions to do this, however be aware that this scenario is unsupported.

An supported alternative is to make MonoTouch drive the application, load any assemblies you need, expose those and then transfer control to your Objective-C code.

Upvotes: 2

Related Questions