JNI , shared stubs, CFunction (not CFunc) ?

Discussion in 'Java' started by rover, Nov 10, 2004.

  1. rover

    rover Guest

    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
     
    rover, Nov 10, 2004
    #1
    1. Advertising

  2. rover

    Chris Uppal Guest

    rover wrote:

    > 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
     
    Chris Uppal, Nov 10, 2004
    #2
    1. Advertising

  3. rover

    rover Guest

    rover wrote:
    > 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 :)
     
    rover, Nov 10, 2004
    #3
  4. rover

    Curt Cox Guest

    I'm having trouble building disp.dll. Does anybody have pre-built
    binaries, or know where I can get them?
     
    Curt Cox, Dec 17, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bbmerong
    Replies:
    0
    Views:
    148
    bbmerong
    Jan 17, 2008
  2. bbmerong
    Replies:
    0
    Views:
    121
    bbmerong
    Jan 17, 2008
  3. bbmerong
    Replies:
    0
    Views:
    151
    bbmerong
    Jan 18, 2008
  4. bbmerong
    Replies:
    2
    Views:
    141
    Ken Bloom
    Jan 18, 2008
  5. Jonathan Gold
    Replies:
    0
    Views:
    93
    Jonathan Gold
    Sep 24, 2009
Loading...

Share This Page