[Mono-list] PInvoke Conventions

Rhys Weatherley rweather@zip.com.au
Wed, 18 Jul 2001 12:02:33 +1000


I've been investigating PInvoke support for Portable.NET,
and I've come across some icky issues that will probably
affect Mono's VM as well.

In particular, because "int" and "long" have different types
on different CPU's, it is difficult to write PInvoke declarations
in C# that will work with all Unix libc's.  The result would
be libraries and applications that need to be compiled
separately for 32-bit and 64-bit systems.

To avoid duplication of effort, I propose we come up with a
common way of solving these problems.  Towards that end,
I have placed the following document on my Web site that
describes how I think this can be resolved:

http://www.southern-storm.com.au/pinvoke.html

Comments are welcome.

Cheers,

Rhys.

P.S. Thanks to the person who mentioned "libffi" as a way
of doing PInvoke.  That is a very nice library.