10 messages in net.java.dev.jna.users[jna-users] Using custom libraries (dll)
FromSent OnAttachments
Jorge Nieto-MadridJan 7, 2009 4:14 am 
Timothy WallJan 7, 2009 5:38 am 
Jorge Nieto-MadridJan 7, 2009 5:55 am 
Timothy WallJan 7, 2009 7:08 am 
Jorge Nieto-MadridJan 7, 2009 8:04 am 
Timothy WallJan 7, 2009 8:09 am 
Jorge Nieto-MadridJan 7, 2009 8:24 am 
Timothy WallJan 7, 2009 12:15 pm 
Jorge Nieto-MadridJan 8, 2009 6:36 am 
Timothy WallJan 8, 2009 6:47 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:[jna-users] Using custom libraries (dll)Actions...
From:Jorge Nieto-Madrid (jorg@gmail.com)
Date:Jan 7, 2009 4:14:53 am
List:net.java.dev.jna.users

Hi Timothy,

I stopped using JNA for a while. Now I started using it again and have a trivial question: How do I declare an interface for Non-native/Custom DLLs?

I know that for all DLLs in C:\windows\system32 I must just extend StdCallLibrary, like in this code snipset (for Kernel32.dll):

public interface Kernel32 extends StdCallLibrary { // Method declarations, constant and structure definitions go here

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

// Optional: wraps every call to the native library in a // synchronized block, limiting native calls to one at a time Kernel32 SYNC_INSTANCE = (Kernel32) Native.synchronizedLibrary(INSTANCE); .......

So the vital part is: Native.loadLibrary("kernel32", Kernel32.class, W32API.DEFAULT_OPTIONS);

Lets assume I have the library Saphira.dll in the path C:\Spahira\

How can define interface for it??

Thanks a lot