[Mono-list] PInvoke Conventions

Rhys Weatherley rweather@zip.com.au
Sun, 29 Jul 2001 16:15:35 +1000


Miguel de Icaza wrote:

> > The trick is coming up with a *standard* way of doing
> > this black magic.  I fear that if the "C wrapper" crowd
> > wins this war, then the resulting C# library will only work
> > with Mono's VM and the rest of us will have to start
> > from scratch.
>
> I have to disagree with the conclussion Rhys.  [...]
>
> We are not advocating the use of internalcalls to solve the problem.
> We will be using PInvoke, but wont be using any extra magic to label
> the PInvoke methods: instead we will put the magic on a support shared
> library (which we need anyways).

And which will no doubt be hard-wired to Mono API
and autoconf conventions, and hence useless to anyone
else who may be interested in running applications built
to work with the Mono C# library.  Hence, the rest of
us will have to start from scratch.

The proposal to use type diversion, where "stat" can be
diverted to a "NativeStat" in a platform-specific assembly
is much better than this.  The platform-specific parts are
completely in a C#-based "native.dll" which is portable
from one VM to another.  Any approach that uses C to
make the glue will bind the C# library to one VM only.

Rhys.