gmodule for wince



I use the gmodule library to manage plugins with windows mobile with mingw32ce. Only the sub file gmodule-win32.c exists for that. 
But this file cause some problems with the functions GetProcAddress and LoadLibrary. The confusions results from the call of these functions of the wide char type GetProcAddressW and LoadLibraryW at the compile process. But the used strings are not wide char strings. 
I had solved this by enforcement of GetProcAddressA, because this function is in windows ce available. 
But Loadlibrary is available only as wide char function. Therefore I use the #define pragma at every occurrence. 
The attached patch works very well for me. Some lines of ToDo I do not need currently. 
Does somebody have another suggestion? Or could and should gmodule-win32.c be adapted appropriately?

Regards
Hanro

@@ -42,2 +42,11 @@
 #endif
+
+#ifdef __CEGCC__  /* ToDo: the right statement for glib? */
+ #undef GetProcAddress
+ #define GetProcAddress GetProcAddressA
+#endif
 
@@ -131,3 +145,7 @@
       if (!kernel32)
-	if (!(kernel32 = GetModuleHandle ("kernel32.dll")))
+#ifdef __CEGCC__
+	if (!(kernel32 = GetModuleHandleW (L"kernel32.dll")))  /* ToDo: library is to be adapted for win ce */
+#else
+	if (!(kernel32 = GetModuleHandle ("kernel32.dll")))
+#endif
 	  return NULL;
@@ -175,4 +194,8 @@
     {
-      if (!psapi)
-	if ((psapi = LoadLibrary ("psapi.dll")) == NULL)
+      if (!psapi)
+#ifdef __CEGCC__
+	if ((psapi = LoadLibrary (L"psapi.dll")) == NULL)  /* ToDo: library is to be adapted for win ce */
+#else
+	if ((psapi = LoadLibrary ("psapi.dll")) == NULL)
+#endif
 	  return NULL;
@@ -228,8 +253,11 @@
     {
-      if ((p = GetProcAddress (GetModuleHandle (NULL), symbol_name)) == NULL)
+      if ((p = GetProcAddress (GetModuleHandle (NULL), symbol_name)) == NULL)	/* ToDo: adaptation for wide char of windows ce required */
 	p = find_in_any_module (symbol_name);
     }
-  else
-    p = GetProcAddress (handle, symbol_name);
+  else
+  {
+    p = GetProcAddress (handle, symbol_name);	/* ToDo: adaptation for wide char of windows ce required */
+  }
 
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]