Native windows dll access problem from PlugIn [message #318496] |
Tue, 31 July 2007 07:39 |
Eclipse User |
|
|
|
Originally posted by: pzabawa.poczta.onet.pl
I would like to make use of sun JNA library to communicate to my C++ dll.
The communication works perfectly when I load and call the dll from a Java
project (Java Application). However when I do the same from my Eclipse
PlugIn the library does not load and the plugin hungs during this process.
What shall I do step by step to be able both to load dll and call
functions from it from Eclispe PlugIn?
Thank you in advance.
Piotr
|
|
|
Re: Native windows dll access problem from PlugIn [message #318505 is a reply to message #318496] |
Tue, 31 July 2007 11:31 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Piotr,
You posted this same question on the SWT newsgroup separately. Please
don't do that. If you must post to multiple newsgroups, please do so
with a single posting addressed to all the groups so that an answer on
one group appears on all groups. Someone already tried to answer your
question on the other newsgroup...
Piotr wrote:
> I would like to make use of sun JNA library to communicate to my C++
> dll. The communication works perfectly when I load and call the dll
> from a Java project (Java Application). However when I do the same
> from my Eclipse PlugIn the library does not load and the plugin hungs
> during this process. What shall I do step by step to be able both to
> load dll and call functions from it from Eclispe PlugIn?
> Thank you in advance.
> Piotr
>
>
|
|
|
|
Re: Native windows dll access problem from PlugIn [message #319623 is a reply to message #318496] |
Tue, 28 August 2007 12:57 |
Eclipse User |
|
|
|
Originally posted by: gerold.broser.easyklick.com
Piotr:
> I would like to make use of sun JNA library to communicate to my C++
> dll. The communication works perfectly when I load and call the dll from
> a Java project (Java Application). However when I do the same from my
> Eclipse PlugIn the library does not load and the plugin hungs during
> this process. What shall I do step by step to be able both to load dll
> and call functions from it from Eclispe PlugIn?
> Thank you in advance.
> Piotr
Hi Piotr,
1. It is called JNI (Java Native Interface ;)
2. A C wrapper DLL is useful, since it is like Matthew mentioned: the functions have to be named specially. I created a
separate Eclipse C project to create this DLL.
3. One (or more) Java wrapper class(es) is/are helpful, since the function names in the C wrapper DLL are derived from
the package structure + wrapper class name + method name + arguments. I put the Java wrapper class(es) in a separate
Eclipse plugin project, and defined this project as dependency of my main plugin project.
4. http://java.sun.com/docs/books/jni/html/preface.html and http://www.codeproject.com/java/jnibasics1.asp are good
starting points.
Regards, and good luck!
Geri
|
|
|
Powered by
FUDForum. Page generated in 0.02727 seconds