[Issue 9931] Mac OS X ABI not followed when returning structs for extern (C)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Apr 25 23:35:23 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9931
--- Comment #22 from Jacob Carlborg <doob at me.com> 2013-04-25 23:35:21 PDT ---
(In reply to comment #21)
> Here's the code from pastebin. I'd prefer small examples to be posted here
> rather than linked to.
Fair enough. Here's the latest test case. It doesn't depend on any external
functions or casts:
C code:
struct Foo
{
int a;
int b;
int c;
};
typedef struct Foo Foo;
Foo foo (int a)
{
Foo f;
f.a = 1;
f.b = 2;
f.c = 3;
return f;
}
D code:
struct Foo
{
int a;
int b;
int c;
}
extern (C) Foo foo (int a);
Foo bar ()
{
return foo(0);
}
extern (C) int printf(in char*, ...);
void main ()
{
auto frame = bar();
printf("a=%d b=%d c=%d\n".ptr, frame.a, frame.b, frame.c);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list