using third-party dll in java programs

Discussion in 'Java' started by Andrew Makhorin, Nov 24, 2003.

  1. There is a multi-thread w32 dll written entirely in ISO C with the only
    exception that TlsAlloc/TlsFree are used. There is also someone who
    wishes to use C functions from the dll in Java programs, and the only
    requirement is not to change the dll code.

    Could anyone please explain me if it is possible, i.e. if there any Java
    specific requirements due to which the dll code must be changed to
    conform such requirements? In particular, may the Java garbage collector
    conflict with thread-local storage used in the dll? (Please note that
    I am a C programmer, and Java is Greek to me :+).

    Thank you,

    Andrew Makhorin
    Andrew Makhorin, Nov 24, 2003
    #1
    1. Advertising

  2. Andrew Makhorin wrote:
    > There is a multi-thread w32 dll written entirely in ISO C with the only
    > exception that TlsAlloc/TlsFree are used. There is also someone who
    > wishes to use C functions from the dll in Java programs, and the only
    > requirement is not to change the dll code.
    >
    > Could anyone please explain me if it is possible, i.e. if there any Java
    > specific requirements due to which the dll code must be changed to
    > conform such requirements?


    Yes, there are very strict requirements defined in the JNI (Jaba native interface)
    standard. It's probably the best idea to write a wrapper in C that confirms
    to the JNI conventions and simply forwards the calls to the DLL, converting the
    data format if necessary.
    Michael Borgwardt, Nov 24, 2003
    #2
    1. Advertising

  3. Andrew Makhorin

    nos Guest

    I only did this once but I was able to use a windows 'dll' file
    without any change to it.


    "Michael Borgwardt" <> wrote in message
    news:bpthdn$1t0rj1$-berlin.de...
    > Andrew Makhorin wrote:
    > > There is a multi-thread w32 dll written entirely in ISO C with the only
    > > exception that TlsAlloc/TlsFree are used. There is also someone who
    > > wishes to use C functions from the dll in Java programs, and the only
    > > requirement is not to change the dll code.
    > >
    > > Could anyone please explain me if it is possible, i.e. if there any Java
    > > specific requirements due to which the dll code must be changed to
    > > conform such requirements?

    >
    > Yes, there are very strict requirements defined in the JNI (Jaba native

    interface)
    > standard. It's probably the best idea to write a wrapper in C that

    confirms
    > to the JNI conventions and simply forwards the calls to the DLL,

    converting the
    > data format if necessary.
    >
    nos, Nov 24, 2003
    #3
    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. =?Utf-8?B?QmlsbCBCb3Jn?=

    'Access is denied' to third-party dll

    =?Utf-8?B?QmlsbCBCb3Jn?=, May 12, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    417
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    May 13, 2005
  2. Ezhil
    Replies:
    1
    Views:
    635
    Bruce Barker
    Sep 19, 2005
  3. Robert Birn
    Replies:
    3
    Views:
    791
    Robert Birn
    Oct 31, 2003
  4. Replies:
    6
    Views:
    1,007
  5. Tina I
    Replies:
    11
    Views:
    411
    Tina I
    May 17, 2007
Loading...

Share This Page