[Mono-list] pinvoke4
James F. Bellinger
zer@neo.rr.com
Thu, 3 Oct 2002 22:08:27 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_0001_01C26B29.71C40C60
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
If I may make a guess, a bool has a size of 1, and the three Boolean
values are being aligned to four bytes.
Have a nice day :-)
Jim Bellinger
-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com] On
Behalf Of Ferguson, Neale
Sent: Tuesday, October 01, 2002 10:20 PM
To: Monolist (E-mail)
Subject: [Mono-list] pinvoke4
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_000_0001_01C26B29.71C40C60
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Monotype Corsiva";
panose-1:3 1 1 1 1 2 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p
{margin-right:0in;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman";}
span.EmailStyle18
{font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>If I may make a guess, a bool has a =
size
of 1, and the three Boolean values are being aligned to four =
bytes.</span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Have a nice day </span></font><font
size=3D2 color=3Dnavy face=3DWingdings><span =
style=3D'font-size:10.0pt;font-family:
Wingdings;color:navy'>J</span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Jim Bellinger</span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original =
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> =
mono-list-admin@ximian.com
[mailto:mono-list-admin@ximian.com] <b><span =
style=3D'font-weight:bold'>On Behalf
Of </span></b>Ferguson, Neale<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Tuesday, October =
01, 2002
10:20 PM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> Monolist (E-mail)<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [Mono-list] =
pinvoke4</span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>In </span></font><font =
size=3D2
color=3Dmaroon face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:maroon'>pinvoke4.cs</span></font><font size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'> simplestruct is defined =
as:</span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblue
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:blue'> public struct
SimpleStruct {<br>
&=
nbsp;
public bool a;<br>
&=
nbsp;
public bool b;<br>
&=
nbsp;
public bool c;<br>
&=
nbsp;
public string d;<br>
}</span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>In </span></font><font =
size=3D2
color=3Dmaroon face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:maroon'>libtest.c</span></font><font size=3D2 face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'> simplestruct is defined =
as:</span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblue
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:blue'>typedef struct {<br>
int a;<br>
int b;<br>
int c;<br>
char *d;<br>
} simplestruct</span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>However, when =
</span></font><font
size=3D2 color=3Dblue face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:blue'>mono_create_trampoline</span></font><font =
size=3D2
face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'> the =
size of the
returned by: </span></font><font size=3D2 color=3Dblue face=3D"Courier =
New"><span
style=3D'font-size:10.0pt;font-family:"Courier =
New";color:blue'>mono_class_value_size
(sig->ret->data.klass, NULL)</span></font><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'> is 8. Why is it not 16? I =
guess the
answer is it should be 16 but I'm doing something =
stupid.</span></font></p>
</div>
<p style=3D'margin-left:.5in'><font size=3D3 face=3D"Monotype =
Corsiva"><span
style=3D'font-size:12.0pt;font-family:"Monotype Corsiva"'>Neale =
Ferguson</span></font>
</p>
</div>
</body>
</html>
------=_NextPart_000_0001_01C26B29.71C40C60--