[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 22 20:08:07 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=5570



--- Comment #41 from thelastmammoth at gmail.com 2013-09-22 20:07:53 PDT ---
(In reply to comment #40)
> (In reply to comment #39)
> > This leads to a lot of duplication, for example the authors had to duplicate c
> > bindings just to address this:
> > https://github.com/Jebbs/DSFML-C where they point to this bug.
> 
> I wonder if as a workaround you could type the prototypes in D as:
> 
> // note the .tupleof
> sfWindow* sfWindow_create(VideoMode.tupleof mode, const(char)* title, uint
> style, const(ContextSettings)* settings);


corrected that to sfWindow_create(typeof(VideoMode.tupleof), ...)

> 
> And then call it via:
> 
> VideoMode vm;
> sfWindow_create(vm.tupleof, ...);

still segfaults

> 
> I'd assume this would then properly use the stack? It's worth trying out to
> avoid any new code duplication, and then when 5570 is finally fixed all you
> have to do in user code is to remove ".tupleof" in the calls.


so far my (sad) woraround is to add a new C function that takes a pointer to
the struct, and link against it.

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