Re: [Ikvm-developers] Qt Jambi on IKVM
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2006-11-09 13:07:05
|
Hi Jon,
The name decoration is indeed not required (and ikvm looks for both the =
decorated and undecorated names -- this is actually the reason why ikvm =
cannot automagically determine the calling convention, if the decoration =
was always consistent, I would be able to dynamically select the proper =
calling convention).
Here's an example of the type of errors I get:
C:\j\qt\qtjambi-win-1.0.0-tp3>\ikvm\bin\ikvm -cp .;qtjambi.jar =
com.trolltech.demos.TextEdit
QtJambi: Exception pending in native code
java.lang.IllegalArgumentException: Invalid format of path: ???=F6
at =
com.trolltech.qt.QClassPathEngine.setFileName(QClassPathFileEngineHandler=
.java)
at =
com.trolltech.qt.QClassPathEngine.<init>(QClassPathFileEngineHandler.java=
)
at =
com.trolltech.qt.QClassPathFileEngineHandler.create(QClassPathFileEngineH=
andler.java)
at IKVM.Runtime.JNIEnv.InvokeHelper(Unknown Source)
at IKVM.Runtime.JNIEnv.CallObjectMethodA(Unknown Source)
at com.trolltech.qt.gui.QIcon.__qt_QIcon_String(QIcon.java)
at com.trolltech.qt.gui.QIcon.<init>(QIcon.java)
at com.trolltech.demos.TextEdit.init(TextEdit.java)
at com.trolltech.demos.TextEdit.showEvent(TextEdit.java)
at IKVM.Runtime.JNIEnv.InvokeHelper(Unknown Source)
at IKVM.Runtime.JNIEnv.CallVoidMethodA(Unknown Source)
at com.trolltech.qt.gui.QWidget.__qt_show(QWidget.java)
at com.trolltech.qt.gui.QWidget.show(QWidget.java)
at com.trolltech.demos.TextEdit.main(TextEdit.java)
QtJambi: Exception pending in native code
java.lang.IllegalArgumentException: Invalid format of path: ???=F6
at =
com.trolltech.qt.QClassPathEngine.setFileName(QClassPathFileEngineHandler=
.java)
at =
com.trolltech.qt.QClassPathEngine.<init>(QClassPathFileEngineHandler.java=
)
at =
com.trolltech.qt.QClassPathFileEngineHandler.create(QClassPathFileEngineH=
andler.java)
at IKVM.Runtime.JNIEnv.InvokeHelper(Unknown Source)
at IKVM.Runtime.JNIEnv.CallObjectMethodA(Unknown Source)
at com.trolltech.qt.gui.QIcon.__qt_QIcon_String(QIcon.java)
at com.trolltech.qt.gui.QIcon.<init>(QIcon.java)
at com.trolltech.demos.TextEdit.init(TextEdit.java)
at com.trolltech.demos.TextEdit.showEvent(TextEdit.java)
at IKVM.Runtime.JNIEnv.InvokeHelper(Unknown Source)
at IKVM.Runtime.JNIEnv.CallVoidMethodA(Unknown Source)
at com.trolltech.qt.gui.QWidget.__qt_show(QWidget.java)
at com.trolltech.qt.gui.QWidget.show(QWidget.java)
at com.trolltech.demos.TextEdit.main(TextEdit.java)
*** exception in native code ***
System.NullReferenceException: Object reference not set to an instance =
of an object.
at com.trolltech.qt.gui.QWidget.__qt_show(Int64 )
Exception in thread "main" java.lang.NullPointerException
at IKVM.Runtime.JNIEnv.InvokeHelper(Unknown Source)
at IKVM.Runtime.JNIEnv.CallVoidMethodA(Unknown Source)
at com.trolltech.qt.gui.QWidget.__qt_show(QWidget.java)
at com.trolltech.qt.gui.QWidget.show(QWidget.java)
at com.trolltech.demos.TextEdit.main(TextEdit.java)
I also looked at the disassembly of com_trolltech_qt_core.dll and unless =
I'm mistaken it looks like it doesn't pop the method arguments from the =
stack (as is required by __stdcall).
Regards,
Jeroen
> -----Original Message-----
> From: Jon Chambers [mailto:jo...@gm...]=20
> Sent: Thursday, November 09, 2006 14:00
> To: Jeroen Frijters
> Cc: ikv...@li...
> Subject: Re: [Ikvm-developers] Qt Jambi on IKVM
>=20
> Hi Jeroen,
>=20
> First, thanks for the work on ikvm. The fact this is=20
> *possible* is very cool.
>=20
> A google or two found some hits with questions about stdcall=20
> vs. cdecl with JNI. From what I gather (if information on=20
> internet is reliable ;-) ), JNI should be stdcall on windows=20
> *but* alot of links state that the JVM is looking for=20
> unmangled names anyway. This can be accomplished via a def=20
> file in VS, or a flag on gcc. So, I'm wondering if the=20
> undecorated names in com_trolltech_qt_core.dll are still=20
> stdcall. Would undecorated names cause a problem for the IKVM=20
> JNI layer? If not, any other thoughts? I'm willing to track=20
> this down myself with some direction. It seems from the=20
> output that the library was loaded, was the symbol resolved?=20
> I'm trying to find out what the exact error is.=20
>=20
> Thnaks Alot,
> Jonathan
>=20
>=20
> On 11/9/06, Jeroen Frijters <je...@su...> wrote:
>=20
> Hi Jon,
> =09
> I can't get *any* of the examples/demos included in the=20
> preview to work
> on ikvm. From the looks of it, I'd guess that the various
> com_trolltech_qt_*.dlls use the wrong calling convention for the
> exported JNI methods.=20
> =09
> On Windows, JNI methods need to use the __stdcall=20
> calling convention
> (usually this is done automatically by the JNICALL=20
> #define in jni_md.h).
> For some unfortunate reason __cdecl also appears to=20
> work on the Sun JVM,=20
> but unfortunately ikvm cannot magically support both.
> =09
> Also see:
> =09
> http://weblog.ikvm.net/PermaLink.aspx?guid=3D42da1751-bf3e-44df-
> a43a-e198d=20
> 6a26c06
> =09
> Regards,
> Jeroen
> =09
> > -----Original Message-----
> > From: ikv...@li...
> > [mailto: ikv...@li...] On
> > Behalf Of Jon Chambers
> > Sent: Thursday, November 09, 2006 02:50
> > To: ikv...@li...=20
> <mailto:ikv...@li...>=20
> > Subject: [Ikvm-developers] Qt Jambi on IKVM
> >
> > Hi everyone,
> > I am trying out Qt Jambi
> > (=20
> http://www.trolltech.com/developer/downloads/qt/qtjambi-techp=20
> <http://www.trolltech.com/developer/downloads/qt/qtjambi-techp>=20
> > review) on IKVM. These are official Java bindings from
> > Trolltech that are about to be released; they are at their
> > final technology preview right now. Anyway, I wrote a sample=20
> > app that works great under ikvm.exe. However, my goal is
> > really to use Qt from C#. So, I compiled the qtjambi.jar file
> > with ikvmc, and got an assembly. I wrote my app in C# an
> > everything built. However, when I run my app I get the=20
> > following error (note I got some debug tracing by adding
> > IKVM.Internal.Tracer.EnableTraceForDebug () to the beginning
> > of my app). I think the JNI method in question resides in
> > com_trolltech_qt_core.dll which seems to get loaded. If this=20
> > is a problem in qtjambi, I'll like to let them know before
> > the final release; it would be very cool if IKVM could help
> > get C# bindings from the java ones. But again my app runs
> > fine on ikvm, so I'm guessing it's something specific to=20
> > ikvmc? Any help/direction would be appreciated.
> >
> > Thanks,
> > Jonathan Chambers
> >
> > C:\eclipse\QtJambiTest\bin\Debug>QtJambiTest.exe
> > [20:41:25.20312 ] Core assembly:
> > C:\eclipse\QtJambiTest\bin\Debug\IKVM.GNU.Class=20
> > path.dll
> > [20:41:25.20312 ] Remapping type System.Exception to
> > java.lang.Throwable
> > [20:41:25.20312 ] Remapping type System.IComparable to
> > java.lang.Comparable
> > [20:41:25.20312 ] Remapping type System.Object to=20
> java.lang.Object
> > [20:41:25.20312 ] Remapping type System.String to=20
> java.lang.String
> > [20:41:25.62500 ] loadLibrary:
> > C:\eclipse\QtJambiTest\bin\Debug\QtCore4.dll, cla=20
> > ss loader: java.lang.ClassLoader$1@2004EEE
> > [20:41:25.62500 ] loadLibrary:
> > C:\eclipse\QtJambiTest\bin\Debug\qtjambi.dll, cla
> > ss loader: java.lang.ClassLoader$1@2004EEE
> > [20:41:25.62500 ] loadLibrary:
> > C:\eclipse\QtJambiTest\bin\Debug\QtCore4.dll, cla
> > ss loader: java.lang.ClassLoader$1@2004EEE
> > [20:41:25.62500 ] loadLibrary:
> > C:\eclipse\QtJambiTest\bin\Debug\QtGui4.dll, clas=20
> > s loader: java.lang.ClassLoader$1@2004EEE
> > [20:41:25.62500 ] loadLibrary:
> > C:\eclipse\QtJambiTest\bin\Debug\com_trolltech_qt
> > _core.dll, class loader: java.lang.ClassLoader$1@2004EEE
> > [20:41: 25.64062 ] Linking native method:
> > com/trolltech/qt/core/QtJambi_LibraryIn
> > itializer.__qt_initLibrary()V, class loader =3D
> > java.lang.ClassLoader$1@2004EEE, s
> > hort =3D
> >=20
> Java_com_trolltech_qt_core_QtJambi_1LibraryInitializer__1_1qt_=20
> > 1initLibrar
> > y, long =3D
> > Java_com_trolltech_qt_core_QtJambi_1LibraryInitializer__1_1qt_
> > 1initLib
> > rary__, args =3D 8
> > [20:41:25.64062 ] UnsatisfiedLinkError:
> > com/trolltech/qt/core/QtJambi_LibraryIni=20
> > tializer.__qt_initLibrary()V
> >
> > Unhandled Exception: System.TypeInitializationException: The
> > type initializer fo
> > r 'com.trolltech.qt.gui.QApplication' threw an exception.
> > ---> System.TypeInitia
> > lizationException: The type initializer for
> > 'com.trolltech.qt.core.QCoreApplicat
> > ion' threw an exception. --->
> > System.TypeInitializationException : The type initi
> > alizer for ' com.trolltech.qt.core.QObject' threw an
> > exception. ---> System.TypeI
> > nitializationException: The type initializer for
> > 'com.trolltech.qt.QtObject' thr
> > ew an exception. ---> System.TypeInitializationException :
> > The type initializer f
> > or 'com.trolltech.qt.QtJambi_LibraryInitializer' threw an
> > exception. ---> System
> > .TypeInitializationException: The type initializer for
> > 'com.trolltech.qt.QClassP=20
> > athFileEngineHandler' threw an exception. --->
> > System.TypeInitializationExceptio
> > n: The type initializer for
> > 'com.trolltech.qt.core.QAbstractFileEngineHandler' t
> > hrew an exception. ---> System.TypeInitializationException:
> > The type initializer
> > for 'com.trolltech.qt.core.QtJambi_LibraryInitializer '
> > threw an exception. --->
> > java.lang.UnsatisfiedLinkError:
> > com/trolltech/qt/core/QtJambi_LibraryInitialize=20
> > r.__qt_initLibrary()V
> > --- End of inner exception stack trace ---
> > at com.trolltech.qt.core.QtJambi_LibraryInitializer.init ()
> > at=20
> com.trolltech.qt.core.QAbstractFileEngineHandler..cctor ()
> > --- End of inner exception stack trace ---
> > at=20
> com.trolltech.qt.core.QAbstractFileEngineHandler.__<clinit>()
> > at com.trolltech.qt.QClassPathFileEngineHandler..cctor ()
> > --- End of inner exception stack trace ---=20
> > at=20
> com.trolltech.qt.QClassPathFileEngineHandler.__<clinit>()
> > at com.trolltech.qt.QtJambi_LibraryInitializer..cctor()
> > --- End of inner exception stack trace ---
> > at com.trolltech.qt.QtJambi_LibraryInitializer.init ()
> > at com.trolltech.qt.QtObject..cctor()
> > --- End of inner exception stack trace ---
> > at com.trolltech.qt.QtObject.__<clinit>()
> > at com.trolltech.qt.core.QObject..cctor ()
> > --- End of inner exception stack trace ---
> > at com.trolltech.qt.core.QObject.__<clinit>()
> > at com.trolltech.qt.core.QCoreApplication..cctor()
> > --- End of inner exception stack trace ---=20
> > at com.trolltech.qt.core.QCoreApplication.__<clinit>()
> > at com.trolltech.qt.gui.QApplication..cctor()
> > --- End of inner exception stack trace ---
> > at com.trolltech.qt.gui.QApplication..ctor=20
> (String[] strarr)
> > at QtJambiTest.Program.Main(String[] args) in
> > C:\eclipse\QtJambiTest\Program.
> > cs:line 13
> >
> >
> =09
>=20
>=20
>=20
|