summaryrefslogtreecommitdiff
path: root/gio/src/liststore.ccg
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2023-03-27 15:20:04 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2023-03-27 15:20:04 +0200
commitb7ad9b86d70003c065606c563578cc66dcd2ce0a (patch)
tree264e2c4723ba49647707a71b04c778f2e5b30124 /gio/src/liststore.ccg
parentd3874b1ec56d6db6b393e94daa1aded0f94d4b8b (diff)
downloadglibmm-b7ad9b86d70003c065606c563578cc66dcd2ce0a.tar.gz
Gio: Use callback functions with C linkage
* gio/giomm/socketsource.cc: Add extern "C". * gio/src/application.[ccg|hg]: Call Application_Class::open_callback() via a local function with C linkage. * gio/src/asyncinitable.[ccg|hg]: Call AsyncInitable_Class::init_async_vfunc_callback() and init_finish_vfunc_callback() via local functions with C linkage. * gio/src/dbusobjectmanagerclient.ccg: Use a local function with C linkage instead of Glib::destroy_notify_delete<SlotProxyType>. * gio/src/file.ccg: Add extern "C". * gio/src/liststore.ccg: Add a TODO comment. * gio/src/memoryinputstream.ccg: Add extern "C". * gio/src/settings.ccg: Add extern "C". * gio/src/socketcontrolmessage.[ccg|hg]: Call SocketControlMessage_Class::deserialize_async_vfunc_callback() via a local function with C linkage. Code that mixes up C linkage and C++ linkage has undefined behavior. Most compilers make no difference between C and C++ linkage, so it has not been an issue so far. Part of issue #1
Diffstat (limited to 'gio/src/liststore.ccg')
-rw-r--r--gio/src/liststore.ccg6
1 files changed, 5 insertions, 1 deletions
diff --git a/gio/src/liststore.ccg b/gio/src/liststore.ccg
index 9c95e7ef..dd5580f3 100644
--- a/gio/src/liststore.ccg
+++ b/gio/src/liststore.ccg
@@ -21,6 +21,9 @@ namespace
{
extern "C"
{
+// Non-static functions with C linkage get external linkage, even if they are
+// defined in an anonymous namespace.
+//TODO: Declare 'static' when we can break ABI.
int ListStoreBase_CompareDataFunc(gconstpointer a, gconstpointer b, gpointer user_data)
{
auto slot = static_cast<Gio::ListStoreBase::SlotCompare*>(user_data);
@@ -33,6 +36,7 @@ int ListStoreBase_CompareDataFunc(gconstpointer a, gconstpointer b, gpointer use
return (*slot)(item_a, item_b);
}
+//TODO: Declare 'static' when we can break ABI.
// gboolean is int
gboolean ListStoreBase_EqualFuncFull(gconstpointer a, gconstpointer b, gpointer user_data)
{
@@ -45,7 +49,7 @@ gboolean ListStoreBase_EqualFuncFull(gconstpointer a, gconstpointer b, gpointer
return (*slot)(item_a, item_b);
}
-}
+} // extern "C"
} // anonymous namespace
namespace Gio