24 messages in net.java.dev.jna.usersRe: [jna-users] Re: Mapping Struct to...
FromSent OnAttachments
thex...@email.comNov 1, 2008 1:46 am 
Timothy WallNov 1, 2008 5:04 am 
thex...@email.comNov 1, 2008 8:40 am 
Timothy WallNov 1, 2008 11:14 am 
Timothy WallNov 1, 2008 11:17 am 
thex...@email.comNov 2, 2008 12:30 am 
Timothy WallNov 2, 2008 7:42 am 
thex...@email.comNov 3, 2008 2:02 am 
Timothy WallNov 3, 2008 3:49 am 
thex...@email.comNov 3, 2008 4:51 am 
Timothy WallNov 3, 2008 6:22 am 
thex...@email.comNov 3, 2008 7:47 am 
Timothy WallNov 3, 2008 8:21 am 
thex...@email.comNov 3, 2008 11:19 pm 
Timothy WallNov 4, 2008 5:33 am 
Timothy WallNov 4, 2008 5:34 am 
thex...@email.comNov 4, 2008 2:33 pm 
Timothy WallNov 5, 2008 5:44 am 
thex...@email.comNov 5, 2008 8:15 am 
Timothy WallNov 5, 2008 9:19 am 
thex...@email.comNov 5, 2008 3:22 pm 
Timothy WallNov 5, 2008 7:00 pm 
thex...@email.comNov 6, 2008 3:36 am 
thex...@email.comNov 6, 2008 10:55 pm 
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] Re: Mapping Struct to JavaActions...
From:thex...@email.com (thex@email.com)
Date:Nov 2, 2008 12:30:08 am
List:net.java.dev.jna.users

Hi Thank you so much for your hints. I wouldn't know what to do without them. I
simply reached the limit of my knowledge universe.

One other thing to check is whether FFACE_API is defined as "__stdcall"; if so you need to use StdCallLibrary instead of Library to ensure the proper calling convention is used. This is another thing that could cause a crash.

Did not find anything special. This pre-compiler commands are all thats in the
header file besides struct's and function calls.

#ifndef FFACE_API_EXPORTS # define FFACE_API __declspec(dllimport) #else # define FFACE_API __declspec(dllexport) #endif

Is there any way to "extract" information about the functions and structs from
the corresponding library FFACE.lib? I got the dll, the header file and the library.
As a matter of fact the header is not complete and outdated I guess probably nobody
is using it. I found a C# file that defines all function calls including the one of
the header file plus about 30 more than that.

See what "sizeof(INVENTORYITEM)" returns in C#, and ensure that Structure.size() returns the same thing in Java. If there are any #pack directives in the header to change the structure layout, it might also cause the size to be different than the default.

sizeof() not usuable on INVENTORYITEM - it says INVENTORYITEM does not have a
fixed size. Had to determine the size of the return value with
System.Runtime.InteropServices.Marshal.SizeOf(). The estimation in Java resulted in a size of 4 - C# told me the same value.

I did start using Native.setProtected(true) - either because of this or because
of multiple tests done in a short period I had to encounter that the returned structure may
contain random values. Up to 5 runs out of 10 features random negative numbers in the return value.

The C compiler automatically generates the second argument if you omit it. JNA will do no such thing, so your declaration of the function *must* include the second argument.

Oh, I see. Thanks for explaining.

Regards, Armin