

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
11 messages in net.java.dev.jna.usersRe: [jna-users] Fwd: https://jna.dev....| From | Sent On | Attachments |
|---|---|---|
| Timothy Wall | Feb 29, 2008 5:14 am | |
| Paul Loy | Feb 29, 2008 6:10 am | |
| Timothy Wall | Feb 29, 2008 7:07 am | |
| Timothy Wall | Feb 29, 2008 7:46 am | |
| Diego | Feb 29, 2008 8:15 am | |
| Emmanuel Pirsch | Feb 29, 2008 8:55 am | |
| Duncan McGregor | Feb 29, 2008 9:41 am | |
| Jøran Vagnby Lillesand | Mar 1, 2008 3:49 am | |
| Timothy Wall | Mar 2, 2008 6:10 am | |
| Hackett, Mark | May 8, 2008 5:41 am | .html |
| Timothy Wall | May 9, 2008 11:19 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread 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/#demos | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Mar 2, 2008 6:10:54 am | |
| List: | net.java.dev.jna.users | |
On Feb 29, 2008, at 11:44 AM, Hackett, Mark wrote:
Thanks for answering. And so quickly.
If I can suggest:
StdCallLibrary :- don't use this. It's not a portable element. If we're going to make a noddy, make it portable. We don't care if all we get out of it is "Hello World". Kernel32 isn't portable and it doesn't give us anything we *need*.
So that is one less thing to look up and one less thing to change if you're not on Windows.
If I can stave off 90% of stupid emails asking why their windows program crashed by providing a win32 example, it's probably worth it. Most linux users know how to read online documentation, and look for important details.
It's not your SAT score that's a problem, it's that your example is a one-system trick and there's no mention of how you'd do it different.
Point 5:
I've tried what looked to be right:
interface JNALib extends Library { JNALib INSTANCE = (JNALib)Native.loadLibrary("JNALib", JNALib.class);
}
but got:
JNATestAPI.java:31: JNALib is abstract; cannot be instantiated JNALib lib = new JNALib();
for my trouble.
I couldn't tell if your comments said you had a lot of Java experience or if that was one of those typos where you end up typing the opposite of what is true. The above is a fairly basic Java issue.
Now that may be because I got it *completely* wrong. But given I couldn't cut'n'paste ('cos you used Kernel32), I can't even START to look for the problem. That's why point 4 was a problem.
Point 6 may be because Java doesn't want me to do what it wants. Public classes want to be in their own file. But a one-file test gets rid of any problems with externalities (like, for example, having the right import line, or having to remember that updating that file means you update X other files, etc). And again, point 4 means I can't tell if it's badly explained or I'm doing it wrong.
This is another fairly basic Java issue. If you want to put everything in one file, the first choice is to put everything within the file's main class definition. You *can* put a default-access class outside of the main class, but that's generally considered poor form. In general, I shy away from over-constraining stuff on the main page, and only do that when it constrains people away from bad behavior.
Whether a structure is included within the interface definition or not is only important when you start doing custom type mapping, which is beyond the scope of the beginner intro.
1) compile a stupid C library that just prints "hello world" and that's one file.
Not a bad suggestion, I've added a hello, world snippet to the main page as the first example. Hopefully the varargs isn't too advanced for newbies :)
And if it's not possible to make a single Java file to do this, then the "howto" needs to say "create a file with this in, then create one with this in". This stops errors like "class JNANoddyLib is declared public so needs to be in its own file" appearing. But maybe JNANoddyLib didn't *need* to be public. I don't know enough to say.
Run through a few more Java tutorials. You've got to get JavaNoddyLib down before you get to JNANoddyLib (or at least should, before throwing out too many invectives to others about it).
The idea is to get anyone who's looking to not have to think until they want to change the noddy program to do something useful. But if they change something, they know it's what they changed and not because they missed or misconstrued something.
I'd prefer JNA users think from day one, 'cuz if you don't already understand the libraries you're calling, you're in for a heap of trouble. I'd like to make it very easy to use, but I'm the skateboard manufacturer, not the helmet manufacturer.
Sorry I'm taking so long and including a lot of disparate elements here, but I don't expect a quick answer (you're busy elsewhere and I'm not the boss of you) and so if I can get the most in one message, you don't have to keep track of the mail trail to see if I'm being a dufus or whether there is a point to be made.
Ta.
Just keep it on the list rather than pointed at me personally (pay attention to the fact that I keep redirecting your messages to the list -- this has no value to me as a personal conversation). There are plenty of knowledgeable folks here who are willing to help.








.html