[Mono-list] Interop

Javier Miguel Gonzalez javier.miguel@experian.es
Mon, 10 Jan 2005 18:44:14 +0100


Hello John,

Did you mean that I can call SWIG to create a c++ wrapper for a Mono dll
(managed)?

I was searching swig.org but I only see methods to create managed code to
call c++ (unmanaged)...

Do you know where can I find an example/doc about how to do it?

Regards

Javier Miguel

> -----Mensaje original-----
> De: John Lenz [mailto:lenz@cs.wisc.edu]
> Enviado el: martes, 14 de diciembre de 2004 19:41
> Para: Javier Miguel Gonzalez
> CC: mono-list@lists.ximian.com
> Asunto: Re: [Mono-list] Interop
>
>
> On 12/14/04 09:50:55, Javier Miguel Gonzalez wrote:
> > > > I want to call a .Net function (in a class) from unmanaged
> > > code, like VC+
> > > > +
> > > > 6
> > > > or Delphi 7.
> > > >
> > > > Do you know if it is possible?
> > > >
> > > > Are there something like JNI in .Net?
> > > >
> > > > I have read this articles:
> > > >
> > > >
> > > http://www.blong.com/Conferences/BorCon2004/Interop1/Win32AndD
> > otNetInterop.h
> > > tm#InversePInvoke
> > >
> > > http://www.codeproject.com/csharp/Win32_to_NET.asp
> > >
> > > ...but I feel that this methods are not so much standard.
> > >
> > > Are in Mono something better to do it than in MS .Net Framework?
> >
> > > You could also check out SWIG at http://www.swig.org,
> which has C# support
> > > and works with the Microsoft runtime, mono, and
> Portable.NET.  There are a
> > > lot of examples on wrapping code provided by SWIG as well.
> > >
> > > John
> >
> > Will Swig allow a VB6 or Delphi7 developer call a function
> within a managed
> > dll/so library?
> >
>
> I don't actually know about C#, but I assume so.  I use SWIG for the
> guile and python languages, and it allows C code to call into guile
> and python code.  I assume C# wouldn't be any different.  If you can,
> I would go with SWIG since it automates all that repetitive code you
> need to write.
>
> I am almost certain that you are going to need to call
> Delphi or VB6 -> C -> C#
> and SWIG would take care of the C -> C# part.
>
> By the way, SWIG uses PInvoke.  SWIG is just a tool that generates
> all the Pinvoke code for you, so you don't need to write it yourself.
>
> John
>
>