Cannot compile C file using ImportC

Stefan Koch uplink.coder at googlemail.com
Tue Nov 9 20:05:47 UTC 2021


On Tuesday, 9 November 2021 at 19:53:48 UTC, Steven Schveighoffer 
wrote:
> On 11/9/21 2:34 PM, Stefan Koch wrote:
>> On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
>>> [...]
>> 
>> 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 builds fine.
>
> It also builds fine with gcc.
>
> -Steve

Yes it is valid C.
It is not valid D though.



More information about the Digitalmars-d-learn mailing list