#include C headers in D code

Walter Bright newshound2 at digitalmars.com
Wed Apr 11 18:36:56 UTC 2018


On 4/11/2018 3:25 AM, Atila Neves wrote:
> I did the best I could having seen some macros. It's likely there are cases I've 
> missed, or that maybe the translation in the link above doesn't work even for 
> what it's supposed to be doing (I have no confidence about catching all the C 
> casts for instance).
> 
> If there are other cases, I'll fix them as they're encountered. It's possible 
> some of them can't be fixed and the user will have to work around them. Right 
> now I have a feeling it will probably be ok. Time will tell (assuming I have 
> users!).


That's right. There is no general solution. One can only look for common 
patterns and do those. For example,

   #define X 15

is a common pattern and can be reliably rewritten as:

   enum X = 15;



More information about the Digitalmars-d-announce mailing list