aboutsummaryrefslogtreecommitdiff
path: root/packages/patches/darwin/darwin_dlopen.patch
blob: a93ef7edabb98966e48f7309df48fc6b18cbc4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Index: s_loader.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_loader.c,v
retrieving revision 1.4
diff -u -w -r1.4 s_loader.c
--- s_loader.c	6 Sep 2004 20:20:35 -0000	1.4
+++ s_loader.c	26 Nov 2005 00:27:11 -0000
@@ -2,6 +2,9 @@
 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
 
+#ifdef __APPLE__
+#define DL_OPEN
+#endif
 #ifdef DL_OPEN
 #include <dlfcn.h>
 #endif
@@ -13,7 +16,7 @@
 #include <io.h>
 #include <windows.h>
 #endif
-#ifdef MACOSX
+#ifdef MACOSX10.2
 #include <mach-o/dyld.h> 
 #endif
 #include <string.h>
@@ -90,7 +93,7 @@
     if (lastdot = strrchr(nameptr, '.'))
         *lastdot = 0;
 
-#ifdef MACOSX
+#ifdef MACOSX10.2
     strcpy(symname, "_");
     strcat(symname, nameptr);
 #else
@@ -122,7 +125,7 @@
     }
     makeout = (t_xxx)GetProcAddress(ntdll, symname);  
 #endif
-#ifdef MACOSX
+#ifdef MACOSX10.2
     {
         NSObjectFileImage image; 
         void *ret;
@@ -134,8 +137,18 @@
             return 0;
         }
         ret = NSLinkModule( image, filename, 
-               NSLINKMODULE_OPTION_BINDNOW + NSLINKMODULE_OPTION_PRIVATE); 
-
+               NSLINKMODULE_OPTION_BINDNOW |
+               //NSLINKMODULE_OPTION_PRIVATE |
+               NSLINKMODULE_OPTION_RETURN_ON_ERROR);
+               
+        if (ret == NULL) {
+        	int err;
+        	const char *fname, *errt;
+        	NSLinkEditErrors c;
+        	NSLinkEditError(&c, &err, &fname, &errt);
+        	post("link error %d %s %s", err, fname, errt);
+        	return 0;
+        }
         s = NSLookupSymbolInModule(ret, symname); 
 
         if (s)