<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><font face="Calibri">It'd be nice if declare_procedure gave the size of returned structs.</font></div><div><font face="Calibri">I guess I could deduce it maybe from the "_result" variable or some of the</font></div><div><font face="Calibri">declare_ stuff with typeids that I ignore or something.</font></div><div><font face="Calibri">I've reworked my code to use "standard structs", even though I'd rather not.</font></div><div><font face="Calibri">I'd rather return them by value and have the C compiler deal with it.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">Efficiency and ABI correctness is lost.</font></div><div><font face="Calibri">NT/amd64 passes 1, 2, 4, and 8 byte structs in registers, or somesuch.</font></div><div><font face="Calibri">NT/x86 I think passes some small structs in registers too.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">If we returned structs by value, the left-or-right matter would be solved too.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">Not that ABI correctness is all that important -- so little C code passes</font></div><div><font face="Calibri">or returns structs by value anyway, let alone C code we need to interoperate with.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">But I'd still like to give the C compiler more of the work.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">It SEEMS that local declared procedures take struct parameters</font></div><div><font face="Calibri">as type "struct", with size, and I can pass them with a somewhat strong type.</font></div><div><font face="Calibri">It SEEMS that imported procedures take them by untyped "address".</font></div><div><font face="Calibri">I've reworked my code here. To pass structs by pointer and copy them</font></div><div><font face="Calibri">into a local. I'd rather just pass them by value and have the C compiler</font></div><div><font face="Calibri">deal with it.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">I can now compile and link cm3 for {I386,AMD64,PPC}_DARWIN, using</font></div><div><font face="Calibri">the C backend. It crashes..in RTLinker__InitRunTime.</font></div><div><font face="Calibri">traceLink does manage to output a fair amount before crashing,</font></div><div><font face="Calibri">which is itself actually quite impressive.</font></div><div><font face="Calibri">This is difficult work though!</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">I've also reworked structs slightly to compose them of short, int, INT64</font></div><div><font face="Calibri">in order to raise their alignment, if needed.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">I still predeclare a bunch of struct sizes.</font></div><div><font face="Calibri">I need to make a second pass over the data to discover them all.</font></div><div><font face="Calibri">Or do something higher level still, not just go by size.</font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri">If I try to compile the entire system, I don't get too far beyond</font></div><div><font face="Calibri">cm3 before I hit a C compiler error, something exception handling related.</font></div><div><br></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"><br></font></div><div><font face="Calibri"> - Jay</font></div><br> </div></body>
</html>