libgda r3181 - in branches/libgda-3-2: . libgda/binreloc tools
- From: arminb svn gnome org
- To: svn-commits-list gnome org
- Subject: libgda r3181 - in branches/libgda-3-2: . libgda/binreloc tools
- Date: Sun, 20 Jul 2008 11:14:15 +0000 (UTC)
Author: arminb
Date: Sun Jul 20 11:14:15 2008
New Revision: 3181
URL: http://svn.gnome.org/viewvc/libgda?rev=3181&view=rev
Log:
2008-07-20 Armin Burgmeier <armin openismus com>
* libgda/binreloc/gda-binreloc.c:
* tools/gda-sql.c: Applied the patches from bugs #510739 and
#503321. These have already been applied to trunk, but not to the 3.x
branch. This makes it easier to compile and use libgda on Windows.
Modified:
branches/libgda-3-2/ChangeLog
branches/libgda-3-2/libgda/binreloc/gda-binreloc.c
branches/libgda-3-2/tools/gda-sql.c
Modified: branches/libgda-3-2/libgda/binreloc/gda-binreloc.c
==============================================================================
--- branches/libgda-3-2/libgda/binreloc/gda-binreloc.c (original)
+++ branches/libgda-3-2/libgda/binreloc/gda-binreloc.c Sun Jul 20 11:14:15 2008
@@ -24,6 +24,24 @@
/* include source file as mentionned in gbr_init_lib()'s doc */
#include "binreloc.c"
+#ifdef G_OS_WIN32
+#include <windows.h>
+/* Remember HMODULE to retrieve path to it lateron */
+static HMODULE hdllmodule = NULL;
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+{
+ switch(fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ hdllmodule = (HMODULE)hinstDLL;
+ break;
+ }
+
+ return TRUE;
+}
+#endif
+
+
/**
* gda_gbr_init
*/
@@ -49,6 +67,11 @@
gint size, i;
const gchar *prefix_dir_name;
+#ifdef G_OS_WIN32
+ wchar_t path[MAX_PATH];
+ gchar* p;
+#endif
+
switch (where) {
default:
case GDA_NO_DIR:
@@ -82,7 +105,16 @@
#endif
/* prefix part */
#ifdef G_OS_WIN32
- prefix = g_win32_get_package_installation_directory (GETTEXT_PACKAGE, NULL);
+ /* Get from location of libgda DLL */
+ GetModuleFileNameW (hdllmodule, path, MAX_PATH);
+ prefix = g_utf16_to_utf8 (path, -1, NULL, NULL, NULL);
+ if ((p = strrchr (prefix, G_DIR_SEPARATOR)) != NULL)
+ *p = '\0';
+
+ p = strrchr (prefix, G_DIR_SEPARATOR);
+ if(p && (g_ascii_strcasecmp (p + 1, "bin") == 0 ||
+ g_ascii_strcasecmp (p + 1, "lib") == 0))
+ *p = '\0';
#else
prefix = _gda_gbr_find_prefix (LIBGDAPREFIX);
#endif
Modified: branches/libgda-3-2/tools/gda-sql.c
==============================================================================
--- branches/libgda-3-2/tools/gda-sql.c (original)
+++ branches/libgda-3-2/tools/gda-sql.c Sun Jul 20 11:14:15 2008
@@ -877,8 +877,8 @@
static gboolean env_set = FALSE;
if (!env_set) {
- setenv ("GDA_DATA_MODEL_DUMP_TITLE", "Yes", TRUE);
- setenv ("GDA_DATA_MODEL_NULL_AS_EMPTY", "Yes", TRUE);
+ g_setenv ("GDA_DATA_MODEL_DUMP_TITLE", "Yes", TRUE);
+ g_setenv ("GDA_DATA_MODEL_NULL_AS_EMPTY", "Yes", TRUE);
env_set = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]