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.
1,462
questions
0
votes
0
answers
12
views
Android how to read log, which created by glib
now I'm using fluidsynth so file to play midi note,which write log by glib fun.
for example, g_vsnprintf(xxx);
#define FLUID_LOG g_vsnprintf
if(synth->verbose)
{
FLUID_LOG(...
0
votes
1
answer
12
views
Glib: Calling a iterative loop function
Have a query on timeout calling and GMainContext. It is really confusing to me
Suppose I have the codes below (a bit incomplete, just for demonstration). I use normal Pthreads to create a thread. ...
0
votes
2
answers
41
views
g_utf8_collate() not found in GLib-2.0 on Ubuntu 20.04.3 (LTS)
I've installed in my Ubuntu:
sudo apt-get install libglib2.0-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libglib2.0-dev-bin
but this small test code fails to link:
cat -n test.c
...
0
votes
1
answer
15
views
GLib.Variant new empty array
Documentation says that child_type must be non-None if n_children is zero. So I can't get it. Where is the logic here? What type should I use for an empty array?
Here is my example code:
from gi....
0
votes
1
answer
22
views
libvips FFI use on Windows PHP cannot find glib functions
I am attempting to use the libvips package on Windows 11.
I have installed the composer package "jcupitt/vips": "2.0.0"
My local PHP setup is laragon, and I have enabled the FFI ...
0
votes
1
answer
25
views
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 ...
3
votes
1
answer
92
views
Python Gstreamer bindings with PyGObject Only has Core modules, no Plugins
I have gstreamer installed on OSX 12.0.1 Monterey. I just installed the python bindings inside of a virtual environment running python 3.9 with:
pip3 install pycairo PyGObject
I can import gi and gi....
0
votes
0
answers
24
views
Is it possible to run a glib loop within a glib loop?
Just wondering if this is possible. I have been getting response from one cycle/run of the inner loop. This is my code
struct app{
GMainContext *context;
GMainLoop *loop;
}app1;
int counter = 0;
...
0
votes
0
answers
14
views
Is there a function or method to perform something like std::promise in glib
My question is as above. Is there some methods to perform something similar to std::promise(like performing some action x time later) using glib?
Or is there some timer probe in glib... like putting a ...
0
votes
0
answers
56
views
How to use splitmuxsink in a dynamic pipeline
What is the correct way of using splitmuxsink in a dynamic pipeline?
Previously I have used filesink to record (no problem what so ever) but there is requirement to save the file in segments so I have ...
0
votes
1
answer
54
views
Is there a way to statically link the glib2 library?
Since the production device does not have a glib2 runtime environment, I need to statically link to glib2. I tried to compile and link in the following ways, but it still links libglib-2.0.so.0. I am ...
0
votes
1
answer
35
views
gstreamer callback not working GMainContext
I have this sample application where i create GMainContext and uses it while creating g_main_loop.
GstElement *pipeline;
GstBus *bus;
guint bus_watch_id;
/* init */
gst_init(&argc, &argv);
/*...
0
votes
0
answers
46
views
glib-2.72 build fails with during linking to libglib-2.0.so0.7200.0
*The hardware environment I am working in is a QNAP NAS with x86_64 architecture.
The software is a headless, embedded, QNAP-designed Debian-based Gnu/Linux distro based on kernel 4.14.24.
My current ...
2
votes
1
answer
117
views
Building GStreamer with CMake causes SDP & WebRTC unresolved external symbol errors
I'm building a C++ GStreamer project with CMake which depends on GStreamer, GLIB, Libsoup and json-glib. I'm new to CMake and having trouble setting up my project. I've managed to include many of the ...
0
votes
0
answers
17
views
Is using call_soon_threadsafe and GLib.idle_add together the correct way to safely call GTK code from asyncio, or is it overkill?
I have an application that runs in an asyncio event loop and I want to add a feature that interacts with my Gnome Shell, in particular sending a notification. Since GTK has its own (incompatible, I ...
2
votes
2
answers
82
views
Opening and closing a log file leads to memory leaks in C
Debugging a legacy code. I have a program written in C. it's actually much longer but I have created a small reproducible program to show the issues (please ignore the fact that this program does not ...
1
vote
0
answers
23
views
Problem with trying to define a Gobject boilerplate
I was trying to create a new class but the error occurs
error: ‘OnvifFactory’ was not declared in this scope
G_DEFINE_TYPE (OnvifFactory, onvif_factory, GST_TYPE_RTSP_MEDIA_FACTORY);
This is my code.
...
1
vote
1
answer
57
views
How to make a GTK application that receives data from a TCP socket
I am building a GUI (using C) which receives data to display from another application sending the data over a TCP socket. How do I do this using GTK (just a general overview of the approach I should ...
0
votes
0
answers
68
views
Memory leak with json-c in multi-threaded C++ program
I have a memory leak in my program and cannot understand why.
My program is multi-threaded and uses json-c and glib.
Thread 1 calls the following method every time it receives data over a UDP stream.
...
0
votes
1
answer
21
views
g_log_structured not showing in system journal
I'm attempting to use g_log_structured to output messages from GLib to the Linux journal, but the messages aren't appearing.
#define G_LOG_USE_STRUCTURED
#include <glib-2.0/glib.h>
#include <...
0
votes
0
answers
22
views
Want to append a Many JsonNodes in 1 Main JsonNode one by one using json-glib Library in C language
JsonNode Structure :-
{
"order": [
"ixtrptdktffr9g3oifhgb9r9mo",
],
"posts": {
"groqkkwhcbgkmg7nt8tsuf8b3e": {
"id&...
0
votes
0
answers
70
views
Python GLib.MainLoop.run in a process
In a standalone Python script, I have a functioning GLib mainloop.
# myloop.py
import gobject as GLib
def main():
mainloop = GLib.MainLoop()
# do some DBus related stuffs
mainloop.run()
...
1
vote
1
answer
85
views
The Main Event Loop in GLib and g_timeout_add_full understanding
My question is about g_timeout_add_full(). Here is a small piece of code that I don't understand how it works.
...
g_timeout_add_full(priority1, zero_delay, callback1, ...);
g_timeout_add_full(...
0
votes
0
answers
126
views
Getting and setting Gstreamer element properties using C++
I'm writing a minimal C++ wrapper around the Gstreamer library. I have a class Element, which represents an Gstreamer element.
class Element
{
private:
property* properties;
public:
gchar* ...
3
votes
1
answer
40
views
does gobject depend on glib or glib depend on gobject?
I read a wikipedia page on gobject where it says,
Depending only on GLib and libc, GObject is a cornerstone of GNOME and is used throughout GTK, Pango, ATK
but this GLib API reference page lists ...
0
votes
1
answer
60
views
g_utf8_collate() returns 0 for two Japanese strings which are not equal
The environment on Linux SLES 15SP2:
$ egrep 'LANG|LC_' catserver.log_SRP-30932.20220209
export LC_ALL=de_DE.UTF-8
export DB_LANG=de_DE.UTF-8
export LANG=de_DE.UTF-8
result of comparing two Japanese ...
0
votes
1
answer
45
views
GTK - killing all subprocesses when application window is closed
I noticed that if I kill the app launched from the command line, with CTRL+C - then the subprocesses get killed, while, when clicking the close button of the window title, the process remains running.
...
1
vote
1
answer
45
views
Is there any other way to set the properties of the interface in gbdus besides using this method?
Is there any other way to set the properties of the interface in gbdus besides using org.freedesktop.DBus.Properties:
g_dbus_connection_call_sync(conn,
"org....
0
votes
1
answer
21
views
Contents of GSList change during loop to read file
I'm writing a small program to analyze columns in a CSV file. The first line of the file contains headings, which I store in a GSList. The list contains the correct character arrays after reading the ...
0
votes
0
answers
48
views
How to create a GVariant* to feed to g_variant_iter_new?
The following simple code is sufficient to reproduce the error I am having.
#include<gio/gio.h>
int main()
{
GVariantIter *Iter;
const gchar* s = "[('appname', uint64 size, uint64 ...
0
votes
1
answer
37
views
Convert gpointer to QByteArray in QT
How can I convert gpointer bytes (FT_BYTES) to QByteArray in Qt?
Point:
a) gpointer is a type like void* in glib Linux package.
b) A hex dump like a0 23 5c which is stored as gpointer and I like to ...
1
vote
0
answers
185
views
How can I resolve glib.h not found clang compiler on Mac with VSCode?
I'm experimenting with using VSCode for C development on Mac. I've been having trouble getting VSCode to find glib.h. I installed glib with brew.
I've been using pkg-config to identify my path:
> ...
0
votes
0
answers
15
views
How can I force Homebrew to install a package to a certain dir?
I'd like to brew install glib to my /usr/lib. How can I make this happen?
0
votes
0
answers
78
views
How can i receive a pairing request event via dbus, glib?
I'm currently making a Bluetooth app with BlueZ
I need to get a Pairing request.
Using BlueZ DBus API, i've made my Agent into NoInputOutput mode, and i succeed the first pairing with my phone.
...
0
votes
1
answer
30
views
Glib's hashtable has size 0 after insertion
I notice that calling the g_hash_table_insert on a globally defined hashtable results in no insertion in the hashtable:
#define _GNU_SOURCE
#include <glib.h>
#include <stdio.h>
GHashTable* ...
0
votes
1
answer
63
views
gtk_events_pending( ) is TRUE, but gtk_get_current_event( ) is NULL
I am trying to port an ancient GTK+ app to GTK2 and am stuck with the following problem: In the GTK+ version gtk_events_pending( ) gives 0, while in the GTK2 version it gives 1. There are very few ...
0
votes
0
answers
24
views
How to use the foreach funtion in Glib tree to get the all nodes in it
If possible could you please give me one example of how to use the foreach() function in the GTree to get all nodes in this tree? thank you
0
votes
1
answer
35
views
Accessing a string out of bounds does not trigger any valgrind/ASAN/UBSAN warnings
I have this code:
static int main(string[] args) {
info(escape_latex(args[1]));
return 0;
}
string escape_latex(string input) {
var builder = new StringBuilder.sized(input....
3
votes
2
answers
139
views
`__noinline__` macro conflict between GLib and CUDA
I'm working on an application using both GLib and CUDA in C. It seems that there's a conflict when importing both glib.h and cuda_runtime.h for a .cu file.
7 months ago GLib made a change to avoid a ...
-2
votes
1
answer
257
views
Include pkg-config --cflags --libs gtk+-2.0 in Cmake
I am building c code using cmake on debian11. As I am not much know cmake.
When i build the code i got errot
fatal error: gio/gio.h: No such file or directory
17 | #include <gio/gio.h>
...
0
votes
0
answers
43
views
How to find an hash key giving it it's value using GLib
As the title implies, I'm using GLib to build an hash table where my keys are the ids on my csv file and the value is the number of times they appear on that file. To do that I use :
int tmp = 0;
...
0
votes
0
answers
18
views
How to set keepalive on a GDBusServer over TCP?
When hosting a GDBusServer on a TCP socket on a Linux system, how can I activate the keepalive mechanism of the socket itself? There seems to be no API to access the options of the raw socket (or ...
2
votes
0
answers
77
views
Use gstreamer gtk signaling in QT application
Hi i am writing a small Qt Application and part of that would be a webRTC video stream for which planned to use Gstreamer.
This is where i can into problems.
Naturally my app is a QtApplication and is ...
0
votes
1
answer
55
views
No reference to glib functions
everyone.
I'm working on ubuntu, developing this application using the glib resources, I wrote a makefile like this:
INCLUDES= -I ./headers
FLAGS= -g
PKGCONFIGCFLAGS= `pkg-config --cflags qmi-glib` `...
0
votes
1
answer
38
views
Python: monitor subprocess output with glib?
So far I have gotten away with using the following method for capturing and processing the output of a subprocess:
process = subprocess.Popen(<some-command>, shell=True, stderr = subprocess....
2
votes
1
answer
67
views
GLib.Notification fails to activate action with a non-null VariantType
I'm trying to send a GLib.Notification from my application and pass a string parameter.
The name of the action is action-show-chat-view, and it is registered in the activate () method of my main ...
0
votes
1
answer
37
views
Can I get line number or stack trace from gtkmm and glibmm runtime diagnostic messages?
I'm writing a toy program using gtkmm and glibmm, which are C++ bindings for GTK and Glib. I'm getting some runtime diagnostic messages. They look like this:
(process:2933): GLib-GObject-CRITICAL **: ...
0
votes
1
answer
36
views
GLib.NetworkMonitor incorrect initial network availability in Flatpak app
I'm packaging a Flatpak application that checks the network availability on startup. Since switching to Flatpak packaging I've noticed that the GLib.NetworkMonitor is initially reporting no network ...
1
vote
2
answers
68
views
Create Gtk composite object that doesn't have a container as a parent
As an example, I want to create a very simple Gtk composite object which is a GtkButton inside a GtkBox. That's it. Let's call it BoxedButon
But, I'd like it to have the interface of a GtkButton. ...
1
vote
1
answer
55
views
How to handle log level with GLib
I want to create log level display for my C program.
For example, if launch it with ./my_program -log=warning it display my warning log on standard output.
Same for ./my_program -log=debug or ./...