Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating DLL for Java Native Interface

0 views
Skip to first unread message

Nils Appeldoorn

unread,
Jun 7, 1999, 3:00:00 AM6/7/99
to
Hi all,

I'm writing JNI-files, well I'm trying to. The problem is, the Java
Tutorial explains the JNI-example with Microsoft Visual C++ and that's
a compiler I don't have ...

So, that's why I'm asking you. Can you "translate" this Micorsoft
Visual C++ call to Borland's C++ Builder (which I do have):

cl -Ic:\java\include -Ic:\java\include\win32 -LD
HelloWorldImp.c -Fehello.dll

where c:\java the path is to my jdk. I know the following:

bcc32 -Ic:\java\include -Ic:\java\include\win32 HelloworldImp.c
-ehello.dll

The '-LD' and '-F' are unknown to me ... And when I try the above
command with the Builder, it's not working, I get the following error

Error: Unresolved external '_main' referenced from
C:\PROGRAM FILES\CBUILDER4\CBUILDER4\LIB\C0X32.OBJ

So, can anybody solve this one?

Thanks for your time, hope you can help me.

Nils

JohnDoc

unread,
Jun 7, 1999, 3:00:00 AM6/7/99
to
If you have the Microsoft Visual C++ compiler then you can run cl /? to find
out what the command line options are.

/LD Create .DLL
/Fe<file> name executable file

Note that's /Fe not /F. Microsoft command line options are generally not
compatible with Borland's.

Neither of these options is directly related to the production of
JNI-compatible code -- they specify that you're building a DLL and that its
name is hello.dll. They do not specify calling conventions that you might
need to use for JNI.

Your 'unresolved main' problem is because your compile/link options are
specifying that you want a regular C/C++ executable built and you have no
'main' procedure. It strikes me that you're trying to run before you can
walk so you need to step back a bit and get the basics right.

I think the best thing to do at this point is to read the documentation on
how to create DLLs or use the IDE to target a DLL for you. Once you've
managed to create a basic DLL, find out what calling conventions are
required for JNI and then modify your compile command line accordingly.

Nils Appeldoorn

unread,
Jun 8, 1999, 3:00:00 AM6/8/99
to
Hey JohnDoc,

Thanks for your prompt reply. I don't have the MS Visual C++
compiler, so that was why I asked here in the group. I will
try to get things running.

Thanks for your help!

Nils

0 new messages