DMD-64 2.062 and GCC can't pass >8byte structs?
E.S. Quinn
onetruequinn at hotmail.com
Sat Apr 13 16:19:09 PDT 2013
Er, my apologies. The code on that post won't actually do what
it's supposed to. I wrote my testcode originally with very
idiosyncratic variable names, and hadn't actually recompiled the
code after I changed them for my post. This should actually work:
structc.c:
-------
#include <stdio.h>
struct passingstruct {
unsigned int a;
unsigned int b;
int c;
};
void printatest (struct passingstruct value)
{
printf ("hello!\n");
printf ("%u %u %d\n", value.a, value.b, value.c);
}
----
structd.d:
------
import std.stdio;
struct passingstruct {
uint a;
uint b;
int c;
void printme () {
writefln ("%d %d", a, b);
}
}
int main (char[][] args)
{
passingstruct test = passingstruct( 300, 200, 0);
writefln ("%u %u %d", test.a, test.b, test.c);
printatest (test);
return 0;
}
extern (C)
{
void printatest (passingstruct value);
}
More information about the Digitalmars-d
mailing list