look for %s@%d format symbols when resolving native methods on Windows, which obviates the need for -k flag to dlltool

This commit is contained in:
Joel Dice 2008-10-10 17:37:36 -06:00
parent e3a5c7e03f
commit 5c04c19e29
3 changed files with 9 additions and 4 deletions

View File

@ -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 $(@)

View File

@ -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

View File

@ -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;