8 messages in net.java.dev.jna.usersRe: [jna-users] Fwd: bug for JNA
FromSent OnAttachments
Timothy WallJul 17, 2008 10:18 am 
Wayne MeissnerJul 17, 2008 3:57 pm 
Nikolas LotzJul 18, 2008 1:49 am 
RWAD...@UP.COMJul 18, 2008 5:07 am 
Timothy WallJul 18, 2008 5:41 am 
Timothy WallJul 18, 2008 7:20 am 
Timothy WallJul 18, 2008 7:53 am 
RWAD...@UP.COMJul 18, 2008 8:21 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Fwd: bug for JNAActions...
From:Wayne Meissner (wmei@gmail.com)
Date:Jul 17, 2008 3:57:03 pm
List:net.java.dev.jna.users

Works fine on i386-linux.

When he says 'when I transform my java application with JNA to exe file', could it be that he is using one of those java -> windows exe compilers (which have their own runtime), which is the problem?

2008/7/18 Timothy Wall <twal@dev.java.net>:

Has anyone else seen a problem with structure field ordering with Sun's 1.6.0_07 VM?

Begin forwarded message:

From: "Jiang (EXT), Hongyi" <x_ji@ugs.com> Date: July 17, 2008 1:04:26 PM EDT To: "Timothy Wall" <twal@dev.java.net> Subject: RE: bug for JNA

java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06) Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

Vender is SUN. I hope this can help you.

-----Original Message----- From: Timothy Wall [mailto:twal@dev.java.net] Sent: Thursday, July 17, 2008 5:29 PM To: Jiang (EXT), Hongyi Subject: Re: bug for JNA

What is the VM vendor? Sun, IBM, Oracle?

On Jul 17, 2008, at 11:12 AM, Jiang (EXT), Hongyi wrote:

I use VM java version "1.6.0_07" This problem is not important for me now. I don't make an exe for Java. Anyway Thanks.

-----Original Message----- From: Timothy Wall [mailto:twal@dev.java.net] Sent: Donnerstag, 17. Juli 2008 15:49 To: Jiang (EXT), Hongyi Cc: use@jna.dev.java.net Subject: Re: bug for JNA

What VM are you using?

While the documentation does not require an order, in practice most VMs do preserve order. JNA makes use of this behavior to avoid lines upon lines of manual configuration. GCJ even patched its field storage to provide a predictable order for JNA compatibility.

However, it wouldn't be too much work to extend Structure to accept a List of field names which explicitly indicates their order, to be used with VMs that don't have a predictable field order. It would, though, be a pain when defining a Structure to basically repeat the field list with a list of strings.

On Jul 16, 2008, at 4:42 AM, Jiang (EXT), Hongyi wrote:

Dear Sir,

I am recently using JNA, which is a very good java library to access native library like DLL. I got following exceptions, when I transform my java application with JNA to exe file: Exception in thread "main" java.lang.Error: This VM does not store fields in a predictable order at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) Exception in thread "Thread-2" java.lang.NoClassDefFoundError: com.sun.jna.Native at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source) at java.lang.Void.<unknown>(Unknown Source)

------------------------------------------------------------------------

The application has terminated with exit code: 1

This is a (known) bug in JNA that is not coded to the Java spec.

According to the Java SE API specification of java.lang.Class.getFields() method, it may return fields in any order. Here is an excerpt from the specification:

------------- getFields public Field [] getFields() throws SecurityException Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object. The elements in the array returned are not sorted and are not in any particular order.

-------------

Do you have any new bug free JNA library? Thank you very much.

Regards Hongyi Jiang