Bug 6248 – HTOD leaves out const when translating C headers
Status
RESOLVED
Resolution
WONTFIX
Severity
major
Priority
P2
Component
tools
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-07-04T18:43:00Z
Last change time
2015-06-09T04:36:05Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-07-04T18:43:50Z
test.h:
void foo(const char *str);
$ htod -hc test.h
test.d:
/* Converted to D from test.h by htod */
module test;
extern (C):
void foo(char *str);
This is a big problem because now this function can't be passed a string via toStringz, or even a string literal which is implicitly zero-terminated.
Comment #1 by yebblies — 2011-07-04T19:45:43Z
This is because there is only one version of htod, for D1 and D2, and D1 does not have const. I think the fix would be for htod to emit 'in' instead of const in C function prototypes.
Comment #2 by andrej.mitrovich — 2012-11-02T06:04:03Z
We have better (cross-platform) tools for .h conversion, not gonna wait for Walter.