Cannot compile C file using ImportC
schveiguy at gmail.com
Tue Nov 9 19:53:48 UTC 2021
On 11/9/21 2:34 PM, Stefan Koch wrote:
> On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
>> toml.c(39): Error: cannot implicitly convert expression `malloc` of
>> type `extern (C) void*(ulong __size)` to `extern (C) void*
>> toml.c(40): Error: cannot implicitly convert expression `free` of type
>> `extern (C) void(void* __ptr)` to `extern (C) void function(void*)`
> What's happening here is that dmd seems to see `free` as function rather
> than a pointer to a function.
> changing `static void* (*ppmalloc)(size_t) = malloc;`
> to `static void* (*ppmalloc)(size_t) = &malloc;`
> may solve your issue.
No, the original is valid C, you don't need the address operator.
It's telling that in ldc2 1.28.0, with the new importC feature, it
It also builds fine with gcc.
More information about the Digitalmars-d-learn