Subject: RE: HELP Please!!!!! Problem compiling JNI program under g++
From: "Fowler, John P, CFCTR" <[email-masked]>
To: Mike Fahlbusch <[email-masked]>
Cc: "Cygwin (E-mail)" <[email-masked]>
Date: Fri, 2 Mar 2001 16:20:19 -0500

Mike,
I have no problems compiling the "c" program under gcc but the c++ compiler
chokes with parser errors.  I tried breaking the statement in pieces like
you suggested and I got the same error message for the line with the first
"*".  I did remove the first () on the first line in error and that stopped
the error on that line only.  I would hate to take ownership of the jni.h
file to be able to compile a JNI program on my PC.  

Do you have any other thoughts??

John Fowler

-----Original Message-----
From: Mike Fahlbusch [mailto:[email-masked]]
Sent: Thursday, March 01, 2001 9:38 PM
To: Fowler, John P, CFCTR
Subject: Re: HELP Please!!!!! Problem compiling JNI program under g++

At 16:11 01-03-01 -0500, you wrote:
[snip]

>I am trying to setup an environment under Win NT where I can experiment
with
>C++/JNI programs. When I try to compile the sample C++ program available at
>http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ with g++ I get a
>long list of errors caused by the jni.h file. I made the recommended
>changes to the jlong typedef as described at the site referenced above but
>when I compile the sample program I get the following error
>everywhere JNICALL is used:
>
>    jdk1.2.2/include/jni.h:200: parse error before `*'
>
>I looked at jni.h and line 200 is:
>    jint (JNICALL *GetVersion)(JNIEnv *env);
>
>JNICALL is defined as #define JNICALL __stdcall.
>
>I tried compiling the application under JDK1.2 and JDK1.3 but I still get
>the same error. Any suggestion on what I may be missing???

Perhaps some compilers can't handle statements of the form:

type (ptr)(ptr)

If you break up the statement like this it might give you a tip:

>   jint
>(JNICALL
>*
>GetVersion)
>(JNIEnv
>*
>env);

If you can rephrase the statement to get rid of the ()() or one of the ptrs 
it might help.

Simply deleting the JNICALL might help, many compilers can do without 
stdcall for a few statements.

Also jint might not be a simple type, there could be a compound type or 
something like typedef in its base declaration.  Some compilers can't 
handle multiple casts or can't do things like have extern and typedef in 
the same statement.

If you work it out please tell me how you did it.

-
Regards,
        Mike

Sig:
"Attitude is no substitute for Competence."
Hack.org

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple