// dmodule.d
void d_fn(string s){}
string d_var;
// test.c
__import dmodule;
void fn()
{
d_fn("a");
d_var = "b";
}
test.c(4): Error: function `dmodule.d_fn(string s)` is not callable using argument types `(char*)`
test.c(4): cannot pass argument `"a"` of type `char*` to parameter `string s`
test.c(5): Error: cannot implicitly convert expression `"b"` of type `char*` to `string`
this worked before https://github.com/dlang/dmd/pull/14027
Comment #1 by bugzilla — 2022-05-12T06:35:29Z
The trouble is, the type of a string literal in C is `char*`. A D string is `(immutable char)[]`. Not sure what to do about it.
Comment #2 by bugzilla — 2022-09-25T05:16:30Z
`string` is (immutable char)[], which is not a C type, and so there's not much of anything C can do with it.
Comment #3 by robert.schadek — 2024-12-13T19:22:36Z