[Mono-list] PInvoke Conventions

Bob Salita bsalita@hotmail.com
Wed, 18 Jul 2001 11:39:20 -0500


>[DllImport("libc")] int system(string command);
>
>How does this work on machines in which the "C" definition of "int" is 64
>bits?

Oh dear, I was hoping you were the maven with the answer.

In an earlier post, I gave 13 possible approaches to solving the problem. 
Though some required action by ECMA.

First step is to become acquainted with the scope of the problem. Perhaps 
look at the ANSI standard and ferret out all the troublesome cases.

Rhys previously posted the struct problem example, which poisons many 
seemingly good solutions. Hmmm, but wait, a struct is so C compiler specific 
that there can be no hope of a generalized C#-to-C-struct mapping. Several 
32/32 compilers on the same system can map a struct totally differently. 
Thus I'm concluding that there is no way to reliably handle structs.

Perhaps our obligation is to merely define a generalized handling of data 
types. IMHO, the simplest thing to do is - do nothing. Thus nearly forcing 
the implementation of a class wrapper for each library. Something that Rhys 
wished to avoid at the top of this thread.

Bob.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com