Questions tagged [glib]

GLib is a general-purpose and cross-platform utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on.

GLib is a general-purpose and cross-platform utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on.

For many applications, C with GLib and GObject is an alternative to C++ with STL. It works on many UNIX-like platforms, Windows, OS/2 and BeOS. GLib is released under the GNU Library General Public License (GNU LGPL).

The GLib reference manual can be found at the GNOME developer site.

1529 questions
0
votes
1 answer

g_slice_new doesn't accept my struct type

that is how I build it: gcc pkg-config --cflags --libs gtk+-2.0 -o spawn spawn_with_pipes.c In the snippet of example below, I get an error: syntax error before "Data - it refers to data= g_slice_new(Data); #include typedef struct { …
ultraman
0
votes
1 answer

C Glib Hash Not Matching After Loop Insert?

I'm not sure why this glib hash table is unable to match the keys - I am curious to know why. I read a delimited file and insert it into the hash table, it can read the last value, but not the first or any before that. Any help? I was reading in a…
mcdoomington
  • 518
  • 1
  • 6
  • 20
0
votes
1 answer

Invalid free() / delete / delete[] / realloc() with g_string_free()

I have a GList which contains a collection of GSList. This GSlist contains a collection of GString. When I free the whole GList, I get segmentation fault. Now check the following code. GList *m_rows = NULL; m_rows = mysql_multiple_rows(mysql,…
Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187
0
votes
1 answer

Segfault on g_strdupv function

I am getting segfault on this function. /** * Excutes the passed query and returs the the first row as an array of * strings. You must free this array by calling g_strfreev() */ static gchar** mysql_single_row(MYSQL *mysql_handle, char*…
Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187
0
votes
1 answer

Alternative to g_variant_lookup_value when the key is not an string type

are there any alternative to g_variant_lookup_value when the key is not a string type (i.e. the key is an integer)? I have a function which takes a "a{ias}" dictionary like a GVariant *. I want to get the arrays of strings related to one key (which…
franred
  • 3
  • 1
0
votes
1 answer

Glib GIOChannel

I'm trying a tutorial on glib which uses GIOChannel. I'm using Ubuntu 11.04 (Natty Narwhal) with glib-2.30.2 (gtk+-3.2.3) and C code. The code is from…
mike
  • 1,135
  • 4
  • 22
  • 39
0
votes
1 answer

glib compilation with ios

I am trying to compile glib in ios, i have got an error in gio/tests/appinfo-test.h #include #include int main (int argc, char *argv[]) { const gchar *envvar; gint pid_from_env; envvar = g_getenv…
Karthik
  • 113
  • 1
  • 10
0
votes
3 answers

Absolute path of executable start directory

I am trying to figure out how to grab the start directory for my program. I am using C and have access to GLib. On the Linux side it is easy, g_get_current_directory as soon as the program is launched, and store this value for later use. I tried…
James
  • 3,682
  • 3
  • 22
  • 21
0
votes
1 answer

gtk+ save file while preserving file permissions in linux

I'm writing a text editor in gtk+ 2.0 & gtksourceview 2.0. Currently I'm using gtk_text_buffer_get_text and g_file_set_contents to save the textbuffer to a file. I see in the docs for g_file_set_contents that it says: Also since the file is…
nomadicME
  • 1,389
  • 5
  • 15
  • 35
0
votes
1 answer

thread-safe cache for sparse, lazy, immutable arrays

I have an application that involves a collection of arrays which can be very large (indices up to the maximum value of an int), but which are lazy - their contents are calculated on the fly and are not actually known until requested. The arrays are…
gcbenison
  • 11,723
  • 4
  • 44
  • 82
0
votes
2 answers

GMainContext have ref_count > 0 after unref

I am not getting ref_count to decrease properly for my GMainContext. The example program here is a small version of a large program (which uses threads, hence the need to create a context and push it on the thread). GMainLoop *loop; GMainContext…
Alexander Olsson
  • 1,908
  • 1
  • 15
  • 24
0
votes
1 answer

How to get slice of string?

Is there any function to get a substring in GLib? Something like gchar *getSlice(const gchar *text, gint startIndex);
BPS
  • 1,133
  • 1
  • 17
  • 38
-1
votes
1 answer

Does g_strdup return NULL on memory allocation failure?

The glib documentation lacks many important things that I think API documentation absolutely should include. For instance the entry for g_malloc says nothing about that it will crash upon memory allocation failure (in direct contrast to the…
hlovdal
  • 26,565
  • 10
  • 94
  • 165
-1
votes
1 answer

Is it possible to store, set or update a value inside an existing GVariant

I have a simple floating-point glib variant object whose value I need to update, but there doesn't seem to be any functions to actually do that. The only way seems to be to create a new variant object and update all places that have references to…
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
-1
votes
1 answer

GLib: Replacement for deprecated functions in newer version glib

recently we planned to upgrade glib library to latest version : 2.64 We have built the library and try to use the same in our build infrastructure. While running build we are getting errors :- error: 'g_mem_chunk_alloc0' is deprecated error:…
Naga
  • 59
  • 8
1 2 3
99
100