Bug 6239 – HTOD: Add support for converting opaque C types to D
Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
tools
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-07-01T22:24:00Z
Last change time
2016-08-27T22:06:15Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-07-01T22:24:57Z
E.g.:
typedef struct _cairo_device cairo_device_t;
htod translates this incorrectly to:
alias _cairo_device cairo_device_t;
The closest D idiom to this is:
typedef void cairo_device_t;
Or if typedef is ultimately killed maybe alias would work:
alias void cairo_device_t;
There's a ton of this stuff in C header files. :/
Comment #1 by andrej.mitrovich — 2011-07-01T22:27:52Z
For what it's worth this helps for us porting monkeys:
regex: alias \w+
replace with: typedef void
But you have to do this manually..
Comment #2 by andrej.mitrovich — 2011-07-01T22:33:59Z
Well crap that's not good, it needs to be:
typedef void cairo_device_t;
typedef void _cairo_device;
Stupid C APIs!
Comment #3 by aldacron — 2011-07-02T04:05:53Z
Wouldn't it be more appropriate to translate it as:
struct cairo_device_t {}
Comment #4 by doob — 2011-07-02T06:08:47Z
The most correct translation would be:
struct cairo_device_t;
Comment #5 by andrej.mitrovich — 2016-08-27T22:06:15Z