On Apr 18, 2012, at 12:37 PM, fmcicreate wrote:
> I need to call a C# DLL from C++, and I followed this 
> http://www.mono-project.com/Embedding_Mono
> http://www.mono-project.com/Embedding_Mono . 
> This works on my PC, but now I need to replicate this functionality into 
> android.

Suffice it to say, you're way off the beaten path here. ;-)

The primary question: Will this be a "normal" Mono for Android app in which 
Mono for Android is responsible app startup?

Another issue is that the library you're linking against varies: 
libmonosgen-2.0.so exists only for Debug builds; Release builds use only 
libmonodroid.so. Your `dlopen()` will need to change accordingly.

Assuming you're adding to a normal MfA app, you won't need to call 
mono_jit_init(), because libmonodroid.so does so as part of normal process 
startup. You also won't need to worry about mscorlib.dll/etc., as that's also 
handled as part of normal process startup by mmap()ing the .apk and loading 
them from the .apk:

        
http://docs.xamarin.com/android/advanced_topics/architecture#Application_Packages

I imagine that it's possible (but haven't tested) to write a native library 
that would dlopen libmonodroid.so/libmonosgen-2.0.so and invoke the mono 
embedding APIs to add internal calls/etc., and you'd have a "boostrap" 
Activity/etc. which would use DllImport to load your native library and invoke 
an init function (which would then register any internal calls/etc.).

If you want to be responsible for mono initialization, bypassing the normal 
Mono for Android process startup, then you're also going to need to be 
responsible for everything else as well. I wouldn't suggest _not_ doing this.

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to