port of redo-c to BetterC

Steven Schveighoffer schveiguy at gmail.com
Thu Jun 10 12:04:40 UTC 2021


On 6/10/21 7:21 AM, Dennis wrote:
> On Thursday, 10 June 2021 at 10:23:00 UTC, aquaratixc wrote:
>> Thanks. Its really helpful. However, as I said, there are still 
>> questions: in particular, there is one mistake that I could not 
>> resolve. When I try to copy, I get an error like this: ```
>> redo.o:redo.d:function _D4redo13redo_ifchangeFiPPaZv: error: undefined 
>> reference to '_D4core3sys5posixQk4wait9WIFEXITEDFNaNbNiNfiZb'
>> redo.o:redo.d:function _D4redo13redo_ifchangeFiPPaZv: error: undefined 
>> reference to '_D4core3sys5posixQk4wait11WEXITSTATUSFNaNbNiNfiZi'
>> collect2: ``` although i imported ```core.sys.posix.sys.wait```
> 
> WIFEXITED and WEXITSTATUS are C macros that druntime translates to D 
> functions.
> Importing only means you expect it to be there at link-time. When 
> compiling with `-betterC`, you don't actually link druntime usually. I 
> think it's easiest to just copy-paste those function definitions from 
> druntime to your own source instead of importing them. Or you can 
> compile with optimizations (e.g. `-inline` for dmd, `-O1` for GDC/LDC) 
> and hope the functions get inlined.

Hm... those probably should be marked pragma(inline, true), but I'm not 
sure if that will be a complete fix.

-Steve


More information about the Digitalmars-d mailing list