This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

JNI/gcc problem (solved)

Thanks to Chuck Wilson:

In order for this to work, the --add-stdcall-alias option has to be passed
to the linker on the gcc command line.  So, referring to, the gcc command line
would need to be changed to:

gcc -mno-cygwin -I$jdk/include -I$jdk/include/win32 -Wl,--add-stdcall-alias 
-shared -o HelloWorld.dll HelloWorld.c

I'll update the online version of the tutorial as soon as I can.

-- David.
David P. Caldwell wrote:

> I was having trouble figuring out how to build Java/JNI programs with
> Cygwin.  There were a number of threads in the mailing list about it, and
> some were helpful, but it still took a great deal of slogging.
> After I got it working, I put a tutorial on the web
> ( on how to do it.
> If you are an expert on these matters (and don't feel like reading the
> tutorial), one question came up.  I was unable to link my examples into
> using gcc.  (Or, more properly, I was able to link it into a DLL, but the
> Java virtual machine would invariably complain that the function it was
> looking for did not exist.)  I ended up using LCC-Win32.  There's some
> information about what occurred (and my cygcheck -s output) at

I don't have Java installed on this machine so I can't test this myself.
  But, try the following additional options to gcc:


If that doesn't work, then try again with the above option, but in addition:


Does any of that help?


Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]