JNI , shared stubs, CFunction (not CFunc) ?

R

rover

Hi,

I've been reading about JNI and shared stubs at

http://java.sun.com/docs/books/jni/html/jniTOC.html

However, when i try to use the class "CFunction" (see 9.4.3 @ url) , my
compiler (IntelliJ) says it cannot find the class.
I did find a jnistb10.zip , containing CFunc, CMalloc, CPtr, and the C
code for "disp.dll". However, this zip contains "CFunc" instead of
"CFunction" ! This is fine for wrapping a simple C calling convention
function like "atol" (this example works with CFunc) , but i want to
wrap some "stdcall" win api functions. With CFunc i get an access
violation, probally due to the fact its not a C but a stdcall function.
So i've been searching for the new and improved classes, namely
CFunction , but unfortunally i cannot find it anywhere. Strange how it
seems to be part of the JVM since 1.2 , but just doesnt seem to be there.

Anyone who can help me ?

Thanks,

Rover
 
C

Chris Uppal

rover said:
I've been reading about JNI and shared stubs at

http://java.sun.com/docs/books/jni/html/jniTOC.html

However, when i try to use the class "CFunction" (see 9.4.3 @ url) , my
compiler (IntelliJ) says it cannot find the class.

That class, and the others, are not part of JNI, but are part of a software
package developed by the author and described in his book. (And pretty cool
too, I may add.) If you go up a couple of levels to:

http://java.sun.com/docs/books/jni/

then you'll find a link to download the code for the examples from the book.
That includes the source to the CFunction, etc, as well as the corresponding
JNI source. I haven't tried it, but it looks as if it will handle stdcall
functions, see the file:

jniexamples/chap9/SharedStubs/dispatch_x86.c

for example.

-- chris
 
R

rover

rover said:
Hi,

I've been reading about JNI and shared stubs at

http://java.sun.com/docs/books/jni/html/jniTOC.html

However, when i try to use the class "CFunction" (see 9.4.3 @ url) , my
compiler (IntelliJ) says it cannot find the class.
I did find a jnistb10.zip , containing CFunc, CMalloc, CPtr, and the C
code for "disp.dll". However, this zip contains "CFunc" instead of
"CFunction" ! This is fine for wrapping a simple C calling convention
function like "atol" (this example works with CFunc) , but i want to
wrap some "stdcall" win api functions. With CFunc i get an access
violation, probally due to the fact its not a C but a stdcall function.
So i've been searching for the new and improved classes, namely
CFunction , but unfortunally i cannot find it anywhere. Strange how it
seems to be part of the JVM since 1.2 , but just doesnt seem to be there.

Anyone who can help me ?

Thanks,

Rover


Found it :)

At http://java.sun.com/docs/books/jni/ :


"Download the example code in this book in ZIP or tar.gz formats"

The zip contains what i was searching for :)
 
C

Curt Cox

I'm having trouble building disp.dll. Does anybody have pre-built
binaries, or know where I can get them?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top