Article View: comp.lang.java
Article #51Re: Borland/Native methods query...
From: Lee Hasiuk
Date: Thu, 16 Nov 1995 18:53
Date: Thu, 16 Nov 1995 18:53
46 lines
2694 bytes
2694 bytes
I got the native methods working with Watcom C/C++ 10.5, which is probably less like VC++
than Borland is, so it might also be possible to get it working with Borland. The main
things that I had to do for Watcom:
1) Change __int64 to a class which I defined myself. This must be a VC++ specific data
type.
2) Make the .h files use the #ifndef __cplusplus extern "C" { #endif thing, like the files
that javah produces.
Your compiler pretty much has to support __declspec(dllexport) (Watcom 10.5 does, earlier
versions don't). If
your compiler doesn't, you have to awk/perl the stub .c files to change it to _export or
whatever your compiler needs. You might also have to convert javai.dll to an import
library yourself, if your compiler won't link the import library format that
\java\lib\javai.lib is in. For Watcom you type wlib javai.lib +javai.dll to generate an
import library in Watcom's format.
You can even use the Watcom C/C++ register calling convention, but it requires some
additional steps. If anybody's interested, let me know and I'll send the details.
Lee Hasiuk
leeh@kaworlds.com
Sean Doyle wrote:
>
> It appears (although I am no expert) that Borland C++ 4.5 will *not* work for Java native
> methods because there are compile errors in the standard java\include\win32 include
files.
> Since I'm new to this enviroment {Borland, C++, and Windows95} I could *easily* have made
a
> simple error in setting environment variables. I'm trying to compile this as a Win32 DLL.
> Apparently Borland is stricter than MVC++?
>
> In the "HelloWorld" native example from Sun, the first few compile errors are:
>
> Error:..\..\JAVA\INCLUDE\WIN32\TYPEDEFS.H 34:,expected
> Error:..\..\JAVA\INCLUDE\WIN32\TYPEDEFS.H 35:Multiple declaration for '__int64'
> Error:..\..\JAVA\INCLUDE\WIN32\TYPEDEFS.H 79:'int64_t' cannot start a parameter
declaration
> Error:..\..\JAVA\INCLUDE\WIN32\TYPEDEFS.H 80:Declaration syntax error
> & etc...
>
> Sorry if I'm too clueless.. I know in the future that Sun & Borland are planning to work
> together more closely :-)
>
> Sean Doyle
Technical Details
Message-ID:
<30AB888D.3DAC@kaworlds.com>Path:
arc1-ca.pugleaf.net!murphy.servtech.com!newsReferences:
<30A6891B.59C3@mit.edu> <30A69CE9.3E40@mit.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!murphy.servtech.com!news From: Lee Hasiuk <leeh@kaworlds.com> Newsgroups: comp.lang.java,comp.lang.c++ Subject: Re: Borland/Native methods query... Date: Thu, 16 Nov 1995 13:53:01 -0500 Organization: Worlds, Inc. Message-ID: <30AB888D.3DAC@kaworlds.com> References: <30A6891B.59C3@mit.edu> <30A69CE9.3E40@mit.edu> NNTP-Posting-Host: lhdell.roc.servtech.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.0b2 (Windows; I; 32bit) To: Sean Doyle <mesozoic@mit.edu>