Sender: gianci AT educ DOT disi DOT unige DOT it Message-ID: <36A6FDC4.687AF9C7@freemail.it> Date: Thu, 21 Jan 1999 11:13:24 +0100 From: Junks X-Mailer: Mozilla 3.01Gold (X11; I; Linux 2.0.35 i686) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp,comp.lang.java.help To: djgpp AT delorie DOT com, robert DOT hoehne AT gmx DOT net CC: Teun Burgers Subject: Re: Making a DLL with DJGPP for Java Native Interface References: <36A483F9 DOT 38910023 AT freemail DOT it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com 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 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).