[5429] in java-interest
native methods
daemon@ATHENA.MIT.EDU (Wayne Pinette)
Thu Feb 8 16:10:22 1996
From: Wayne Pinette <pinette@cs.sfu.ca>
To: java-interest@java.sun.com
Date: Thu, 8 Feb 1996 11:35:06 -0800 (PST)
ack ack ack :-)
ok, here is a very very very simple piece of code:
public class t
{
public static void main(String argv[])
{
testy mytest = new mytest();
mytest.hello();
}
}
class testy
{
public native void hello();
static
{
System.loadLibrary("ptest");
}
}
Ok, now I have done this on both SGI and on Win NT and gotten the same
error. On the SGI I write and compile a libptest.so file with the
funciont hello() (I think you can guess what it does:-) and I know the
.so file works cause I link it with a C program and it works fine.
On Windows I create a .dll using MFC which does the same thing (console
app). Ok. The error I get is this:
java.lang.UnsatisfiedLinkError: hello
This means that the library is being successfully loaded, for some
reason, java cannot find the function hello. Incidently, on Win NT I
DID make sure that the function hello is in the EXPORTS section of the
.def file :-) Anyone out there have any experience with native methods?
needless to say, this is a simple case which is actually part of a much
larger experiment :-)
Wayner
--If I had a pizza and a coke on dessert island, I would have the monoply
on entertainment.
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com