[Mono-list] pinvoke4

Dietmar Maurer dietmar@ximian.com
02 Oct 2002 09:30:14 +0200

You need to distinguish 2 cases, managed vs. unmanaged code. The data
representation can be different, for example a bool uses one byte in
managed code, but four bytes in unmanaged code. Data types are
automatically converted by the runtime if you do a PInvoke call. So
thats why SimpleStruct uses 8 byte in managed code, but 32 bytes in
unmanaged code.

- Dietmar

On Wed, 2002-10-02 at 04:20, Ferguson, Neale wrote:
In pinvoke4.cs simplestruct is defined as:
        public struct SimpleStruct {
                public bool a;
                public bool b;
                public bool c;
                public string d;

In libtest.c simplestruct is defined as:
typedef struct {
        int a;
        int b;
        int c;
        char *d;
} simplestruct
However, when mono_create_trampoline the size of the returned by:
mono_class_value_size (sig->ret->data.klass, NULL) is 8. Why is it not
16? I guess the answer is it should be 16 but I'm doing something