Getting the proper value from a GIConstantInfo and a GIArgument

When using the gobject introspection library, how does one extract the proper value of a constant from a typelib?

Now I can extract the GIConstant info out of a type lib, and get the GIArgument obtaining the value, but how can I determine what union member to use WITHOUT prior knowledge of the constant being introspected?

Thanks!

You call g_constant_info_get_type() to get the GITypeInfo of the GIConstant, and then call g_type_info_get_tag() to get the type of the constant data.

2 Likes

@ebassi - Is there any difference between using a .v_int64 over a .v_long?

v_int64 is guaranteed to be at least 64 bit sized; v_long is whatever size long is on the platform you’re building for.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.