Diff

Differences From Artifact [269482c81f]:

To Artifact [21b33f7611]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1win32useopenlibs/tccpe.c
--- tcc-0.9.26.orig/tccpe.c	2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1win32useopenlibs/tccpe.c	2014-05-04 02:00:45.195490003 -0500
@@ -38,6 +38,9 @@
 # define ADDR3264 DWORD
 #endif
 
+#ifdef TCC_IS_NATIVE
+#include <psapi.h>
+#endif
 #ifdef _WIN32
 void dbg_printf (const char *fmt, ...)
 {
@@ -831,7 +834,26 @@
                     if (dllref) {
                         if ( !dllref->handle )
                             dllref->handle = LoadLibrary(dllref->name);
-                        v = (ADDR3264)GetProcAddress(dllref->handle, name);
+                        if (dllref->handle) {
+                            v = (ADDR3264)GetProcAddress(dllref->handle, name);
+                        }


|










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1win32useopenlibs/tccpe.c
--- tcc-0.9.26.orig/tccpe.c	2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1win32useopenlibs/tccpe.c	2014-05-04 02:16:34.590555001 -0500
@@ -38,6 +38,9 @@
 # define ADDR3264 DWORD
 #endif
 
+#ifdef TCC_IS_NATIVE
+#include <psapi.h>
+#endif
 #ifdef _WIN32
 void dbg_printf (const char *fmt, ...)
 {
@@ -831,7 +834,27 @@
                     if (dllref) {
                         if ( !dllref->handle )
                             dllref->handle = LoadLibrary(dllref->name);
-                        v = (ADDR3264)GetProcAddress(dllref->handle, name);
+                        if (dllref->handle) {
+                            v = (ADDR3264)GetProcAddress(dllref->handle, name);
+                        }
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
+                            for (i = 0; i < needed / sizeof(HMODULE); i++) {
+                                v = (ADDR3264)GetProcAddress(modules[i], name);
+                                if (v) {
+                                    break;
+                                }
+                            }
+                        }

                     }
                     if (!v)
                         tcc_error_noabort("undefined symbol '%s'", name);
@@ -1209,9 +1231,34 @@
 
             const char *name = symtab_section->link->data + sym->st_name;
             unsigned type = ELFW(ST_TYPE)(sym->st_info);
-            int imp_sym = pe_find_import(pe->s1, sym);
+            int imp_sym;
             struct import_symbol *is;
 







>



|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
+                            for (i = 0; i < needed / sizeof(HMODULE); i++) {
+                                v = (ADDR3264)GetProcAddress(modules[i], name);
+                                if (v) {
+                                    break;
+                                }
+                            }
+                        }
+                        tcc_free(modules);
                     }
                     if (!v)
                         tcc_error_noabort("undefined symbol '%s'", name);
@@ -1209,9 +1232,34 @@
 
             const char *name = symtab_section->link->data + sym->st_name;
             unsigned type = ELFW(ST_TYPE)(sym->st_info);
-            int imp_sym = pe_find_import(pe->s1, sym);
+            int imp_sym;
             struct import_symbol *is;