Mail Archives: djgpp/1999/01/21/05:13:36
Junks wrote:
>
> I used with great profit in the past DJGPP to write programs which
> worked finely both under Win95/NT and under Linux. Now I have to use the
> algorithms which lie behind these programs within Java. I know that to
> avoid to rewrite them from scratch in Java I can use Java Native
> Interface. In Linux I had no problems, while I had them under Win95/NT
> in building a DLL using DJGPP + RSXNTDJ. I was unable to build a simple
> DLL containing a single function like this one:
>
> int f( int x) { return ++x; }
>
> I set up RSXNTDJ properly yet it seems something is missing. Maybe the
> definition file but I have never used them and I don't know the syntax.
>
> I hope somebody could help me because I enjoyed using DJGPP and I would
> avoid to use other free compilers like Cygnus (I had problems in setting
> it up) or lccwin32 (which is not a C++ compiler).
>
> Thanks in advance.
I fixed the problem. I downloaded a recent version of RSXNTDJ, RSX131
and eventually I succeeded in building a .DLL for JNI. The best option
resulted to be -no-rte (no run time).
In order the whole thing to work you have to do add the lines
#include <windows.h>
typedef long long __int64;
in the jdk\include\win32\jni_md.h file, otherwise it will not compile.
Moreover, I found out the way to build the .DLL within RHIDE, avoiding
the mess of the Makefile which sometimes refuse to work (due to a
strange message "Missing separator" while the Makefile is OK, somebody
knows why?)
The steps to do are:
1) Add the line
RHIDE_COMPILE..dll=$(RHIDE_COMPILE_LINK)
in the shared file rhide.env (which should be in the \share\rhide
subdirectory of DJGPP). Otherwise create it with that single line in the
directory where you work.
2) Add "-Zwin32 -Zdll -Zno-rte" in the Options-Compiler Options
3) Specify the name of the library in the Project-main target name. It
is crucial that the name has the .DLL extension otherwise it will not
work. Be sure also that a file .def with the same name exists
containing a list of the functions which implement the Native methods
headed by the keyword EXPORTS.
That's all folk, now you can create a .DLL file for Java Native
Interface with DJGPP + RSXNTDJ + RHIDE.
Junks, or Gianci (to be read jeeahnchee).
- Raw text -