September 22, 2013 [Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | http://d.puremagic.com/issues/show_bug.cgi?id=5570 thelastmammoth@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thelastmammoth@gmail.com --- Comment #39 from thelastmammoth@gmail.com 2013-09-21 19:48:09 PDT --- (In reply to comment #38) > I don't think the three byte struct issue (see linked bug) has been fixed yet, but I haven't checked in a while. has not been fixed. was going to submit a bug report until I saw this thread. problem with: struct VideoMode{ uint width; uint height; uint bitsPerPixel; } sfWindow* sfWindow_create(sfVideoMode mode, const(char)* title, uint style, const(ContextSettings)* settings); This is used in SFML-D https://github.com/krzat/SFML-D, making it unsable on osx 64bit: the sample program crashes with auto screen = new RenderWindow(VideoMode(800, 600), "Game", WindowStyle.Default, null); which I believe is caused by this. 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 22, 2013 [Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #40 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-22 02:47:30 PDT --- (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); And then call it via: VideoMode vm; sfWindow_create(vm.tupleof, ...); 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 23, 2013 [Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #41 from thelastmammoth@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: ------- |
Copyright © 1999-2021 by the D Language Foundation