port of redo-c to BetterC

Dennis dkorpel at gmail.com
Thu Jun 10 11:21:56 UTC 2021


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.


More information about the Digitalmars-d mailing list