Would appreciate some help porting Q3VM to D (mainly C macros and type conversions)

drug007 drug2004 at bk.ru
Tue Oct 15 17:50:54 UTC 2024


On 15.10.2024 20:37, Mark Bauermeister wrote:
> On Tuesday, 15 October 2024 at 16:05:48 UTC, Lance Bachmeier wrote:
>> On Tuesday, 15 October 2024 at 13:30:03 UTC, Mark Bauermeister wrote:
>>> On Tuesday, 15 October 2024 at 12:27:42 UTC, barbosso wrote:
>>>> Are you heard of https://github.com/dkorpel/ctod ?
>>>
>>> I actually used CTOD for part of the translation but it wouldn't 
>>> translate the macros correctly. It turned them into weird string mixins.
>>
>> It's not as well known, but ImportC also converts C code to D: 
>> https://dlang.org/spec/importc.html#ctod It needs the -inline switch 
>> to output function bodies. The last time I used it, there were 
>> problems with generation of duplicate items, but it was able to handle 
>> most anything I threw at it. Would be worth a try.
> 
> Thanks! That helped me figure out some more macros.
> 
> Now if only I could figure out how to resolve "variable `codeImage` 
> cannot be read at compile time". That's the last thing neither of those 
> automation solutions can help me with.

if you mean line 966 you need to replace `enum` by `const` or even 
`auto`. `enum` means the value should be available in compile time.


More information about the Digitalmars-d-learn mailing list