[Mono-list] PInvoke Conventions

Bob Salita bsalita@hotmail.com
Tue, 17 Jul 2001 22:15:24 -0500

[Apologies if this is a 2nd post, hotmail upgraded this eve. Bob.]

I can forsee this will require alot of back and forth.

Every DllImport call has to be thunked, right? So wouldn't you thunk int to 
native int, long to native long?

So the prettiest definition of lseek() and lseeki64 would be:

[DllImport("libc")] long lseek(int fd, long offset, int whence);
[DllImport("libc")] long lseeki64(int fd, long offset, int whence);

Also, the C compilers definition of int and long are all important, the OS 
or hardware word size are indirect factors. Right?


>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:
>Comments are welcome.

Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp