Varargs issue with LDC

Don Allen donaldcallen at gmail.com
Thu Feb 1 02:22:16 UTC 2024


On Wednesday, 31 January 2024 at 20:01:51 UTC, Steven 
Schveighoffer wrote:
> On Wednesday, 31 January 2024 at 18:11:43 UTC, Johan wrote:
>>
>> Did you check that the D type of `g_type_string/boolean` 
>> matches the size of the type of the C constants? (`GType` 
>> which is `unsigned long` in C, 
>> https://codebrowser.dev/gtk/gtk/subprojects/glib/gobject/gtype.h.html#383)
>
>
> gtkd project uses `size_t`
>
> https://github.com/gtkd-developers/GtkD/blob/17d7dc25e1adc9b86aff381b950f21706118ebeb/generated/gtkd/gobject/c/types.d#L51
>
> -Steve

The D type of g_type_xxxxx was the answer. My hack had defined it 
as uint, should be ulong. So the arguments on the stack were not 
what the C code was expecting.

Now I wonder why my code worked with dmd.

My most cpu-intensive application, the report generator, is about 
9% faster compiled with ldc than dmd, both in release mode.

Thanks to everyone who replied and especially Johan, who asked 
the question that led me to the answer.


More information about the Digitalmars-d mailing list