using third-party dll in java programs

A

Andrew Makhorin

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
 
M

Michael Borgwardt

Andrew said:
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.
 
N

nos

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

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top