[Mono-list] Embedding Mono

Jon Chambers joncham at gmail.com
Mon Feb 5 14:10:57 EST 2007


Lots of people are embedding mono. Please post all of your code, including
the C#, for more help.

Thanks,
Jonathan

On 2/5/07, Jeremy <jswigart at gmail.com> wrote:
>
> It's a static method I guess, exactly like the existing function in the
> example. I wish I could figure out why it's not working for anything other
> than the example function they provide.
>
> Is noone using the embedded mono stuff?
>
> On 2/3/07, Jonathan Pryor < jonpryor at vt.edu> wrote:
> >
> > On Fri, 2007-02-02 at 09:53 -0800, Jeremy wrote:
> > > I've gotten the example to work, however the example shows the case of
> >
> > > a returning mono string. I'm getting crashes in Mono when I attempt to
> > > define additional functions for the assembly to call back into C
> > > with.
> > >
> > > The example shows this
> > >
> > > static MonoString *Sample ()
> > > {
> > >       return mono_string_new (mono_domain_get (), "Hello!");
> > > }
> > >
> > > which works fine, but I can't seem to get functions that take
> > arguments working.
> > >
> > > for example:
> > >
> > > static MonoString* gimme2 (MonoString*a)
> > > {
> > > return mono_string_new (mono_domain_get (), "Hello!");
> > > }
> > >
> > > even though I'm not even using the parameter, simply defining this,
> > > adding it just like mono_add_internal_call, and likewise in the
> > > assembly, I get a crash in mono.
> > >
> > > Is it possible for assembly->c functions to take parameters?
> >
> > Just a guess, but is your C# method an instance method or a static
> > method?  If it's an instance method, you need a `this' pointer in your C
> > code, e.g.
> >
> >         static MonoString*
> >         gimme2 (MonoObject *this, MonoString *a)
> >         {
> >                 return mono_string_new (mono_domain_get (), "Hello!");
> >         }
> >
> > - Jon
> >
> >
> >
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070205/25bf3b31/attachment-0001.html 


More information about the Mono-list mailing list