[Mono-dev] Embedded mono using monomac classes

Mackey Kinard MackeyK24 at Yahoo.com
Fri May 2 02:12:55 UTC 2014


I am trying to make a monomac library project for use in an embedded mono application.

I use a normal monomac library project which has a reference to monomac assembly.

Since I'm using from an c++ application the NSApplicationMain has already been called
For the app by the time the library is used. So I just have an init function, in that init function
I just do a NSApplication.Init so the thread context is setup for c# API for monomac...
Things like NSView and NSColor...

Things work great if I pass an intptr from c++ to construct a class... I.e

NSColor blk = new NSColor(ptr-from-c++);
blk.ToString() work as expected...

But 

NSColor blk = NSColor.Black;
Errors with: No constructor found for MonoMac.AppKit.NSView::.ctor(System.IntPtr)


It's like that with any class that I don't actually construct with the native intptr...

Again this is an embedded application.

My question is ... Is there some kind of "init bindings" that I need to implement since
I am using from embedded app instead of regular monomac app.

Or is there a main .net bindings mechanism that I need to kick off, that the normal non
Embedded useage of monomac does.

Do I have to got and  manually re-make all the objective -c bindings for the monomac API
Because I am using embedded ... That would suck.

Any help or explanations on using the c# API for monomac from and embedded application.

I would hate to have to use c++ code to create instances of object in native code just to
Pass back a pointer to managed code that I could the do something like:

NSView vw = new NSView(native-pointer);
vw.ToString() work fine this way

As of now that is the only way I can create a view with code...

Note: I was using NSColor before for example... All classes constructors are missing when embedding
 
For some reason the .net constructors for the API are not available at runtime (compiles just fine) when embedding mono... Unless I am missing some kind of binding init function.

Thanks for any info.

Sent from my iPad


More information about the Mono-devel-list mailing list