[Mono-list] PInvoke Conventions

Bob Salita bsalita@hotmail.com
Wed, 18 Jul 2001 00:37:53 -0500

Let's enumerate the somewhat-plausible-or-better options:

1. Use multiple dllimport declarations, of differing ints and longs, 
controlled by condition compilation.
2. Translate ints to ints and longs to longs.
3. Create libs with metadata. Interogate metadata.
4. Use method names such as lseek32, lseek64. Create method aliases in libs.
5. Use lib names of clib32, clib64.
6. Create a new data type.
7. Use new attributes.
8. Create wrapper classes for libs. Shift problem to wrapper authors.
9. Ask ECMA for guidance.
10. Watch how Corel does it. (They'll use a 32/32).
11. Annex CDecl, StdCall, WinAPI to behave per our definition.
12. Ask Microsoft.
13. Allow specification of custom data type for individual parameters.

Seems like we should defer to ECMA.

> > (CDecl, StdCall, WinAPI)? Does one of these match my suggestion?
>No.  They just change the x86 instructions used to make the
>call and the order of the parameters.  e.g. flipping between
>C and Pascal style calling conventions.  But my brain is a
>bit rusty on this - I've been on Linux long enough to forget
>most of that stuff, thank God. :-)

They play with the formatting of the parameters, return value, and returned 
stack address. Are you really sure that none of them translate a long into a 
native int? Sorry, I'm wishful thinking.


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