need help to translate C into D

test123 test123 at gmail.com
Tue Sep 13 09:43:46 UTC 2022


On Tuesday, 13 September 2022 at 07:31:50 UTC, Marvin wrote:
> On Tuesday, 13 September 2022 at 06:04:49 UTC, test123 wrote:
>> I can not use importC, I need it to be work in D code.
>>
>>
>> ```d
>> typedef struct {
>>   uint32_t mask_limit;   // Limit enum value that can be 
>> tested with mask.
>>   uint32_t value_count;  // Number of values after the 
>> bitfield.
>>   uint32_t data[];       // Bitmask + enumerated values follow.
>> } upb_MiniTable_Enum;
>> ```
>>
>> I am not sure how to define the `__gshared const 
>> upb_MiniTable_Enum` object for this struct.
>
>
>     struct mystruct {
>       uint32_t mask_limit;   // Limit enum value that can be 
> tested with mask.
>       uint32_t value_count;  // Number of values after the 
> bitfield.
>       uint32_t[] data;       // Bitmask + enumerated values 
> follow.
>     } __gshared mystruct upb_MiniTable_Enum;


This will not work since the C have no array like D.


More information about the Digitalmars-d-learn mailing list