From 5c04c19e293441aee44552c35deb51adaddc72a7 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 10 Oct 2008 17:37:36 -0600 Subject: [PATCH] look for %s@%d format symbols when resolving native methods on Windows, which obviates the need for -k flag to dlltool --- makefile | 2 +- readme.txt | 2 +- src/process.cpp | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index 10ca344844..61b9089d97 100644 --- a/makefile +++ b/makefile @@ -371,7 +371,7 @@ $(executable): \ @echo "linking $(@)" ifeq ($(platform),windows) $(dlltool) -z $(@).def $(^) - $(dlltool) -k -d $(@).def -e $(@).exp + $(dlltool) -d $(@).def -e $(@).exp $(cc) $(@).exp $(^) $(lflags) -o $(@) else $(cc) $(^) $(rdynamic) $(lflags) -o $(@) diff --git a/readme.txt b/readme.txt index a7cd7b2c12..a1f6a1dff9 100644 --- a/readme.txt +++ b/readme.txt @@ -251,7 +251,7 @@ on Mac OS X: on Windows: $ dlltool -z hello.def *.o - $ dlltool -k -d hello.def -e hello.exp + $ dlltool -d hello.def -e hello.exp $ g++ hello.exp *.o -L../../win32/lib -lmingwthrd -lm -lz -lws2_32 \ -mwindows -mconsole -o hello $ strip --strip-all hello.exe diff --git a/src/process.cpp b/src/process.cpp index ecfac1f2d8..c2693d0281 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -167,8 +167,7 @@ resolveNativeMethod2(Thread* t, object method) } #ifdef __MINGW32__ - // on windows, we also try the _%s@%d variant, since the SWT - // libraries use it. + // on windows, we also try the _%s@%d and %s@%d variants unsigned footprint = methodParameterFootprint(t, method) + 1; if (methodFlags(t, method) & ACC_STATIC) { ++ footprint; @@ -186,6 +185,12 @@ resolveNativeMethod2(Thread* t, object method) if (p) { return p; } + + // one more try without the leading underscore + p = ::resolveNativeMethod(t, undecorated + 1, decorated + 1); + if (p) { + return p; + } #endif return 0;