11 messages in net.java.dev.jna.usersRe: [jna-users] Fwd: https://jna.dev....
FromSent OnAttachments
Timothy WallFeb 29, 2008 5:14 am 
Paul LoyFeb 29, 2008 6:10 am 
Timothy WallFeb 29, 2008 7:07 am 
Timothy WallFeb 29, 2008 7:46 am 
DiegoFeb 29, 2008 8:15 am 
Emmanuel PirschFeb 29, 2008 8:55 am 
Duncan McGregorFeb 29, 2008 9:41 am 
Jøran Vagnby LillesandMar 1, 2008 3:49 am 
Timothy WallMar 2, 2008 6:10 am 
Hackett, MarkMay 8, 2008 5:41 am.html
Timothy WallMay 9, 2008 11:19 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: https://jna.dev.java.net/#demosActions...
From:Diego (dcon@gmail.com)
Date:Feb 29, 2008 8:15:49 am
List:net.java.dev.jna.users

I think that the JNA developers are doing a great job and they (in this case Timothy) deserve more respect.

If someone thinks that the documentation is not good enough, he only have to provide a better one. I'm sure that the JNA developers will include it in the web site.

Until I found JNA, integration with native libraries was a REAL pain. With almost no knowledge about C development I learned how to use JNA really quick, and in a couple of days I replaced the work of months with direct JNI (with JNI, the large amounts of documentation available didn't help ;-) ).

By the way, I really think that JNA must be included in official releases of Java. You are doing a really god work!!

2008/2/29, Timothy Wall <twal@dev.java.net>:

(Forwarded to JNA users list on behalf of Mr Hackett)

Begin forwarded message:

From: mark@metoffice.gov.uk [mailto:mark@metoffice.gov.uk] Sent: Friday, February 29, 2008 6:09 PM To: feed@java-net.dev.java.net Subject: RE: https://jna.dev.java.net/#demos

It may be I need to show you where the issue is, so here's the simplest example from your docs:

4. Declare a Java interface to hold the native library methods by extending the Library interface. Following is an example of mapping for the Windows kernel32 library.

package com.sun.jna.examples.win32;

import com.sun.jna.*;

// kernel32.dll uses the __stdcall calling convention (check the function // declaration for "WINAPI"), so extend StdCallLibrary // Most C libraries will just extend com.sun.jna.Library, public interface Kernel32 extends StdCallLibrary { // Method declarations, constant and structure definitions go here }

5. In your interface, allocate an instance of the native library using the Native.loadLibrary(Class) method, providing the native library interface you defined in step (4).

Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);

[OK, so where does it go? there's no other declaration of what class/interface/doodad but it doesn't go inside the declaration of #4.]

6. Declare methods that mirror the functions in the target library by defining Java methods with the same name and argument types as the native function

public static class SYSTEMTIME extends Structure { public short wYear; public short wMonth; public short wDayOfWeek; public short wDay; public short wHour; public short wMinute; public short wSecond; public short wMilliseconds; }

[and where does this go? Nothing said. New class? New interface? Same as #5 (compounding the questions for #5...)]

7. You can now invoke methods on the library instance just like any other Java class. For a more extensive example, see the WindowUtils and ShapedWindowDemo classes.

[Yeah, but the class I did look at (FileMonitor, 'cos I'm on linux), it doesn't call Native.loadLibrary. So that doesn't answer my queries above]

See how if you don't already know how to do this, you aren't any better off after reading this "howto".

On Fri, 2008-02-29 at 12:28 +0000, Mark Hackett wrote:

Your documentation there is damn near useless.

You don't actually make a CLibrary in its entirety. You use two different declarations and don't show why.

Your example codes don't use the Native.loadLibrary code, so you can't see why you use it. you use "extends StdCallLibrary" without saying WHY you're extending that.

Examples should be self contained so you don't have to dig out code from elsewhere to find out what you missed (so your demos are missing a lot of code and don't include the definitions that your example code is using FROM WITHIN THE JNA jars).

If you use a term, unless it's covered under some other topic, explain why you used it (so your use of StdCallLibrary is either missing WHY you use it or where these classes are from, so you can find out). Linking to the frankly piss poor declaration of the class isn't going to work because there aren't any canned examples there (and since you've linked there from a place where you're showing examples, an example IS needed).

If you want someone who knows a little about java and OO programming to read your attempts to make the page useful, feel free to ask me.