CVS: winex/port port.c,1.5,1.6

[email protected] 31 Jul 2007 20:06:09 -0000
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/port port.c,1.5,1.6Update of /var/lib/cvsd/cvsroot/winex/port
In directory agravaine:/tmp/cvs-serv3377/port

Modified Files:
	port.c 
Log Message:
Refactor SHM server to handle both POSIX and SYSV IPC.
Add support for SHM server on Mac OS X.


Index: port.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/port/port.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- port.c	30 Mar 2007 14:43:34 -0000	1.5
+++ port.c	31 Jul 2007 20:06:07 -0000	1.6
@@ -451,6 +451,26 @@
     char *s;
     dlerror(); dlerror();
     ret = dlopen( filename, flag );
+#ifdef __APPLE__
+    /* On the Mac, in a packaged build, there is no way for us to set up the 
+       LD_LIBRARY_PATH once the app has launched.  This prevents certain dynamic
+       loading mechansms (ie: shmserver) from working properly in that environment
+       unless we manually add the required path in. We do so here if the above call 
+       otherwise failed, adding the WINEDLLPATH in as needed */
+    if (!ret)
+    {
+        static char mac_dll_path[4096];
+	unsigned int base_path_len = strlen(getenv("WINEDLLPATH"));
+	if (base_path_len + strlen(filename) < 4096)
+	{
+	    strcpy(mac_dll_path, getenv("WINEDLLPATH"));
+	    mac_dll_path[base_path_len] = '/';
+	    strcpy(mac_dll_path + base_path_len + 1, filename);
+	    
+	    ret = dlopen( mac_dll_path, flag );
+	}
+    }
+#endif
     s = dlerror();
     if (error)
     {
@@ -666,9 +686,10 @@
 /* Get the id of a thread if platform has global tids; otherwise, return pid */
 pid_t wine_gettid_or_pid(void)
 {
-    pid_t ret;
   
 #if defined( __linux__ ) && defined( __i386__ )
+    pid_t ret;
+
     ret = wine_get_global_tid ();
     if( ret >= 0 ) return ret;
 #endif