[Mono-list] PInvoke Conventions

Fergus Henderson fjh@cs.mu.oz.au
Wed, 1 Aug 2001 05:49:48 +1000


On 31-Jul-2001, James Perry <jeperry@uwaterloo.ca> wrote:
> While I agree with you now that an external 'wrapper' library of sorts will
> be needed for this kind of conversion (PosixTypeAttribute is _way_ too much
> work for the runtime to do), I disagree with the naming of it. :)

Well, I'm certainly not particularly attached to the name "wrapper"!
That was just a term describing what it contains, not a suggestion about
what it should be called.

If you want to talk about library naming, then I have some points to make
about that.  All project-specific library names should be prefixed with
the name of the project that they belong to, or some abbreviation of that,
e.g. we use a "mer_" prefix for the names of the Mercury libraries,
and the Mono project should adopt some similar naming convention,
e.g. prefixing all library names with "mono_".  (Note that I'm talking
here about *.a and *.so, not the *.DLL PE files, whose names will have
to match those in the MS implementation.)

> IMHO, all the pinvoke logic for basic type conversion should still be in
> managed C#, not unmanaged C, but an extra /portability/ library be provided
> to give the managed class library a standardized base to work from.

There's already a standardized base to work from -- Posix.  It's just that
Posix standardizes things at the C source level, not the binary level.
The wrapper library is providing *binary portability*.

So it's really not quite the same as the usual practice of writing portability
layers to abstract away API differences between different platforms.
Here we are are merely abstracting away ABI differences, not API differences.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.