Article View: borland.public.jbuilder.java.language
Article #685Calling a dll func from Java
From: yc
Date: Fri, 25 Feb 2005 09:20
Date: Fri, 25 Feb 2005 09:20
30 lines
1507 bytes
1507 bytes
Hi,
I have a c dll (MyDll) stdcall fnc as follows.
stdcall int MyFnc(int FileNo, int IOType, unsigned char * DataToWrite, unsigned char * DataRead);
I try to call from java code, but it gives me an error as follows.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Myfunc
at X.MyFnc(Native Method)
at X.main(X.java:6)
My java code is:
class X {
private native int MyFunc(int fileNo, int IOType, byte[] DataToWrite, byte[] DataRead);
public static void main(String args[]) {
X p = new X();
byte[] c= new byte[512];
byte[] c2= new byte[512];
int result = p.MyFunc(1,0,c,c2);
System.out.println(result);
}
static {
System.loadLibrary("MyDll");
}
}
Any idea ?
Thanks in advance
yc
Technical Details
Message-ID:
<421eedd1$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a69aa8c14ff32559,start X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit From: "yc" <yc@yc.yc> Sender: "yc" <yc@yc.yc> Reply-To: "yc" <yc@yc.yc> Subject: Calling a dll func from Java Newsgroups: borland.public.jbuilder.java.language X-User-Info: 62.244.222.7 NNTP-Posting-Host: 207.105.83.66 Message-ID: <421eedd1$2@newsgroups.borland.com> Date: 25 Feb 2005 01:20:17 -0800 X-Trace: newsgroups.borland.com 1109323217 207.105.83.66 (25 Feb 2005 01:20:17 -0800) Lines: 30 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail