Oddness with C binding
James Miller
james at aatch.net
Wed May 2 21:28:50 PDT 2012
I'm writing bindings to XCB right now, and its mostly going
smoothly. However I have encountered a very strange problem.
This bit of code segfaults with DMD:
auto connection = xcb_connect(null, null);
auto setup = xcb_get_setup(connection);
auto iter = xcb_setup_roots_iterator(setup);
auto screen = iter.data;
But it doesn't segfault with LDC2. This is odd to me because as
far as I am aware LDC2 uses the same front end at DMD. This must
mean that there is a bug in the dmd backend.
I thought it could be related to const optimizations, but I
removed all the const declarations from the appropriate C
bindings and the same thing happened.
I don't have the time to create a minimal test case for this, so
I can't really file a bug report on it. I was also wondering what
could cause this problem. I am using dmd 2.059 and the latest ldc
from the arch repositories.
--
James Miller
More information about the Digitalmars-d
mailing list