int、time_t、およびいくつかの char* を含む構造体のインスタンスの GHashTable を構築しようとしています。
私の質問は、どのように構造体のインスタンスを GHashTable に挿入するのですか? 文字列または int を挿入する方法の例はたくさんありますが (g_str_hash と g_int_hash をそれぞれ使用)、g_direct_hash を使用したいと思っています。
理想的には、私のコードは次のようになります。
GHashtable table;
table = g_hash_table_new(g_direct_hash, g_direct_equal);
struct mystruct;
mystruct.a = 1;
mystruct.b = "hello";
mystruct.c = 5;
mystruct.d = "test";
g_hash_table_insert(table,mystruct.a,mystruct);
コンパイルされないため、明らかにこれは正しくありません。誰でも私が望むことをする例を提供できますか? ありがとう、リク