[gobject-introspection] Windows port: compute GOBJECT_INTROSPECTION_LIBDIR at runtime.
- From: Dieter Verfaillie <dieterv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Windows port: compute GOBJECT_INTROSPECTION_LIBDIR at runtime.
- Date: Wed, 7 Sep 2011 20:04:16 +0000 (UTC)
commit 2e711659d036fcf5a7c2e7201bb1d0fd7334ebb5
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Mon Sep 5 17:19:39 2011 +0200
Windows port: compute GOBJECT_INTROSPECTION_LIBDIR at runtime.
Otherwise, we fail to properly locate the typelibs, because on Windows
the value of GOBJECT_INTROSPECTION_LIBDIR depends on where Glib has been
installed. Due to the nature of how we handle software that depends on
Glib on Windows (it is recommended that each program bundles it's private
copy), we're working in a "multi-prefixed" environment. Hence the value
computed at build time will most likely not even exist at runtime.
https://bugzilla.gnome.org/show_bug.cgi?id=620566
girepository/girepository.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/girepository/girepository.c b/girepository/girepository.c
index a2a778d..cc81107 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -50,6 +50,39 @@ struct _GIRepositoryPrivate
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
+#ifdef G_PLATFORM_WIN32
+
+#include <windows.h>
+
+static HMODULE girepository_dll = NULL;
+
+#ifdef DLL_EXPORT
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ girepository_dll = hinstDLL;
+
+ return TRUE;
+}
+
+#endif
+
+#undef GOBJECT_INTROSPECTION_LIBDIR
+
+/* GOBJECT_INTROSPECTION_LIBDIR is used only in code called just once,
+ * so no problem leaking this
+ */
+#define GOBJECT_INTROSPECTION_LIBDIR \
+ g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \
+ "lib", \
+ NULL)
+
+#endif
+
static void
g_irepository_init (GIRepository *repository)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]