Re: [Ikvm-developers] IKVM / JNA not respecting structure order
Brought to you by:
jfrijters
From: Jeroen F. <je...@su...> - 2011-06-17 19:24:42
|
Just a warning: Trunk my be a bit unstable for a while as we're starting ti work on OpenJDK 7. Sent from my Windows Phone -----Original Message----- From: Bell, Trevor (E O C&S US) Sent: Friday, June 17, 2011 21:11 To: Jeroen Frijters; Volker Berlin; ikv...@li... Subject: RE: [Ikvm-developers] IKVM / JNA not respecting structure order Thanks guys. I'll test out the IKVM trunk and see how it goes. For now, in case anyone else runs into this issue, I decompiled with ildasm, reordered the fields in the generated IL and recompiled with ilasm. -----Original Message----- From: Jeroen Frijters [mailto:je...@su...] Sent: Friday, June 17, 2011 11:59 AM To: Volker Berlin; ikv...@li... Subject: Re: [Ikvm-developers] IKVM / JNA not respecting structure order Hi Volker, Yes, for dynamically compiled code the field order was always retained. Sent from my Windows Phone -----Original Message----- From: Volker Berlin Sent: Friday, June 17, 2011 20:24 To: ikv...@li... Subject: Re: [Ikvm-developers] IKVM / JNA not respecting structure order Hi Jeroen, This sound good. Can this be the cause that our JNA code work only as jar file and not as dll? Or other ask. Does the filed order was different and like the original on the fly compiling? I will test it if it now work as dll in the near future. Volker Am 17.06.2011 07:35, schrieb Jeroen Frijters: > Hi Trevor, > > Java reflection does not guarantee member ordering and IIRC neither does javac (but in practise, both do order them in source order), so it's arguably a bit tricky of JNA to rely on this. > > Having said that, I did recently fix IKVM to maintain field ordering, see http://weblog.ikvm.net/?date=2011-05-18 > > Regards, > Jeroen > >> -----Original Message----- >> From: Bell, Trevor (E O C&S US) [mailto:tre...@si...] >> Sent: Thursday, June 16, 2011 20:40 >> To: ikv...@li... >> Subject: [Ikvm-developers] IKVM / JNA not respecting structure order >> >> Hi, >> >> >> >> I have a Java app which uses JNA to call some Windows APIs. Some of >> those APIs require structures. I have debugged a problem in IKVM and >> found that it is reordering the members of the structure which causes my >> Windows API calls to fail. I have converted JNA.jar and PLATFORM.jar to >> .NET assemblies with IKVM. >> >> >> >> If you look at the struct SecBuffer, in the JNA platform source code, >> here: >> http://java.net/projects/jna/sources/svn/content/trunk/jnalib/contrib/pl >> atform/src/com/sun/jna/platform/win32/Sspi.java?rev=1211 >> >> >> >> You will see that the order of the members matches that of the Windows >> API: >> >> >> >> http://msdn.microsoft.com/en-us/library/aa379814(v=vs.85).aspx >> >> >> >> typedef struct _SecBuffer { >> >> ULONG cbBuffer; >> >> ULONG BufferType; >> >> PVOID pvBuffer; >> >> } SecBuffer, *PSecBuffer; >> >> >> >> >> >> IKVM, however, is re-ordering the members to: >> >> >> >> public NativeLong cbBuffer; >> public Pointer pvBuffer; >> public NativeLong BufferType; >> >> >> >> This would seem to be a bug or am I doing something wrong? >> >> >> >> Thanks! >> >> >> >> -Trevor >> >> > > ------------------------------------------------------------------------ ------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > ------------------------------------------------------------------------ ------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Ikvm-developers mailing list Ikv...@li... https://lists.sourceforge.net/lists/listinfo/ikvm-developers ------------------------------------------------------------------------ ------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Ikvm-developers mailing list Ikv...@li... https://lists.sourceforge.net/lists/listinfo/ikvm-developers |