wilzbach / tools-test

1 stars 0 forks source link

HTOD leaves out const when translating C headers #59

Closed wilzbach closed 9 years ago

wilzbach commented 13 years ago

Note: the issue was created automatically migrated from https://issues.dlang.org

Original bug ID: BZ#6248 From: Andrej Mitrovic <andrej.mitrovich@gmail.com> Reported version: D2 CC: yebblies@gmail.com

wilzbach commented 13 years ago

Comment author: Andrej Mitrovic <andrej.mitrovich@gmail.com>

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.

wilzbach commented 13 years ago

Comment author: yebblies <yebblies@gmail.com>

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.

wilzbach commented 11 years ago

Comment author: Andrej Mitrovic <andrej.mitrovich@gmail.com>

We have better (cross-platform) tools for .h conversion, not gonna wait for Walter.