6 messages in net.java.dev.jna.usersRe: [jna-users] Problem with JNA to a...
FromSent OnAttachments
Kay WAug 20, 2007 11:19 am 
Kay WAug 21, 2007 8:23 am 
Wayne MeissnerAug 22, 2007 9:30 pm 
Kay WAug 23, 2007 6:37 am 
Timothy WallAug 27, 2007 12:30 pm 
Timothy WallAug 27, 2007 12:51 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] Problem with JNA to access vb DLLActions...
From:Timothy Wall (twal@dev.java.net)
Date:Aug 27, 2007 12:30:26 pm
List:net.java.dev.jna.users

On Aug 20, 2007, at 2:20 PM, Kay W wrote:

I am a newbie at JNA and need some assistance. First let me explain what I am trying to do:

I have an unmanaged DLL (I do not have the source code). I would like to create a Java wrapper around this DLL. After several days of intense frustration I have given up on implementing the wrapper using JNI, due to an exception that I cannot resolve. I have thus turned to JNA.

The problem is, I cannot get my JNA code to compile. I am sure that I must be missing something simple. I have include my code below as well as the build error.

Java Code

------------------------------------------------------- Rda2Server.java

--- package rda2;

import com.sun.jna.*;

public interface Rda2Server extends Library { Rda2Server INSTANCE = (Rda2Server)Native.loadLibrary("RDA2", Rda2Server.class);

public void Connect(String DataPath, long Workstation, String Username, String Password); public void Disconnect(); public boolean Connected(); }

rda2.java

--- package rda2;

import com.sun.jna.*;

public class rda2 {

Compilation Error

--------------------------------------------------- C:\j2sdk1.4.2_14\bin>javac D:\WS\DSDProjects\Utility\rda2\rda2.java D:\WS\DSDProjects\Utility\rda2\rda2.java:21: cannot resolve symbol symbol : class Rda2Server location: class rda2.rda2 Rda2Server serverLib = Rda2Server.INSTANCE; ^ D:\WS\DSDProjects\Utility\rda2\rda2.java:21: cannot resolve symbol symbol : variable Rda2Server location: class rda2.rda2 Rda2Server serverLib = Rda2Server.INSTANCE; ^ 2 errors

Since your source file is Rda2Server.java, that is the expected class name, not "rda2".

You also probably need to implement StdCallLibrary. If the method names are decorated (e.g. Connect@16), then you will need to supply a StdCallFunctionMapper to the library init options so that the java names are properly converted to what the DLL is supplying.