relocationless variant of g_enum_register_static
Submitted by Ben Maurer
Link to original bug (#168003)
Description
g_enum_register_static expects an input in the following format:
static const GEnumValue values[] = {
{ GDK_X_CURSOR, "GDK_X_CURSOR", "x-cursor" },
However, because there are strings, the `const' doesn't really work. The entire array gets relocated. This means it has to be put in the .data section of the .so file. Also, it will get touched at runtime, unless you prelink it.
It would be nice to have a system that allows you to do something like this:
static const GEnumConstValue values[] = {
{ GDK_X_CURSOR, 0, sizeof ("GDK_X_CURSOR") },
...
g_enum_register_static ("GdkCursorType", values, "GDK_X_CURSOR" "\0" "x-cursor");
Each GEnumConstValue consists of readonly integers. These integers index into a blob of strings. Everything here can be readonly.
Depends on
Edited by Emmanuele Bassi