[Mono-list] pinvoke4

Ferguson, Neale Neale.Ferguson@SoftwareAG-USA.com
Tue, 1 Oct 2002 22:20:08 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C269BA.3A2A7610
Content-Type: text/plain;
	charset="iso-8859-1"

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 stupid.

Neale Ferguson 



------_=_NextPart_001_01C269BA.3A2A7610
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2713.1100" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=552231503-02102002><FONT face=Arial size=2>In <FONT 
face="Courier New" color=#800000>pinvoke4.cs</FONT> simplestruct is defined 
as:</FONT></SPAN></DIV>
<DIV><SPAN class=552231503-02102002><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=552231503-02102002><FONT face=Arial size=2><FONT 
face="Courier New" color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public struct SimpleStruct 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public bool 
a;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public bool 
b;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public bool 
c;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public string d;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}</FONT><BR></FONT></SPAN></DIV>
<DIV><SPAN class=552231503-02102002><FONT face=Arial size=2>In <FONT 
face="Courier New" color=#800000>libtest.c</FONT> simplestruct is defined 
as:</FONT></SPAN></DIV>
<DIV><SPAN class=552231503-02102002><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=552231503-02102002><FONT face="Courier New" color=#0000ff 
size=2>typedef struct {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int 
a;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int 
b;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int 
c;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *d;<BR>} 
simplestruct</FONT></SPAN></DIV>
<DIV><SPAN class=552231503-02102002><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=552231503-02102002><FONT face=Arial size=2>However, when <FONT 
face="Courier New" color=#0000ff>mono_create_trampoline</FONT> the size of the 
returned by: <FONT face="Courier New" color=#0000ff>mono_class_value_size 
(sig-&gt;ret-&gt;data.klass, NULL)</FONT> is 8. Why is it not 16? I guess the 
answer is it should be 16 but I'm doing something stupid.</FONT></SPAN></DIV>
<P><FONT face="Monotype Corsiva">Neale Ferguson</FONT> <BR></P></BODY></HTML>

------_=_NextPart_001_01C269BA.3A2A7610--