Varargs issue with LDC
Don Allen
donaldcallen at gmail.com
Wed Jan 31 18:15:35 UTC 2024
On Wednesday, 31 January 2024 at 17:54:56 UTC, Steven
Schveighoffer wrote:
> On Wednesday, 31 January 2024 at 17:16:51 UTC, Don Allen wrote:
>
>> The called gtk function has this prototype, which I believe is
>> correct:
>> ````
>> extern (C) GtkListStore* gtk_list_store_new (gint n_columns,
>> ...);
>> ````
>
> Here is what gtkd defines:
>
> https://github.com/gtkd-developers/GtkD/blob/17d7dc25e1adc9b86aff381b950f21706118ebeb/generated/gtkd/gtk/c/functions.d#L7467
>
>> The call site looks like
>> ````
>> writefln("debug: %d", NMktStore.num_cols);
>> store = gtk_list_store_new(NMktStore.num_cols,
>> g_type_string, // date
>> g_type_string, // num
>> g_type_string, // description
>> g_type_boolean, // r
>> g_type_string, // transaction guid
>> g_type_string, // value
>> g_type_string); // balance
>> ````
>> The debugging writefln prints "debug: 7", which is correct.
>
> I'm assuming gint is int?
typedef int gint;
Did you validate that the type
> constants are correct? Double check against gtkd.
Yes, they are correct. I wrote a little C program that generates
an importable D file with various gtk constant definitions
obtained from the gtk header files. Yes, it's a pre-ImportC
kludge. And yes, I checked that the result of the kludge agrees
with the original gtk.h definitions.
And if they weren't correct, I'm very sure the dmd version
wouldn't work nearly as well as it does :-)
>
> It doesn't seem to be anything with this call on first glance.
>
> -Steve
More information about the Digitalmars-d
mailing list