Varargs issue with LDC
Johan
j at j.nl
Wed Jan 31 18:47:17 UTC 2024
On Wednesday, 31 January 2024 at 18:11:43 UTC, Johan 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,
>> ...);
>> ````
>> 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
>> ````
>
> 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)
>
> -Johan
Here is a small example in godbolt. LDC and Clang generate
identical assembly code, so looks like LDC is doing the right
thing here.
https://d.godbolt.org/z/rMK1PqKjv
What C/C++ (nota bene) compiler did you use to build Gtk ?
-Johan
More information about the Digitalmars-d
mailing list