Topic
2 replies Latest Post - ‏2004-04-26T15:56:54Z by SystemAdmin
SystemAdmin
SystemAdmin
9394 Posts
ACCEPTED ANSWER

Pinned topic long long from jniport.h not allowed in MS eMbedded Visual Tools

‏2004-04-23T11:39:36Z |
Hallo,
I try to work with jni and use the compiler out of MS eMbedded Visul
Tools 3.0.
I get an error about long long. Seems the compiler is not C99
compatible.

I change the jniport.h provided by WSDD 5.6
WSDD5.0\ive-2.1\runtimes\pocketpc\arm\ive\bin\include\jniport.h

Original:
#if defined(QNX)
typedef long jlong;
#else
typedef long long jlong;
#endif

Changed:
#if defined(QNX)
typedef long jlong;
#else
#if __STDC_VERSION__ >= 199901L
typedef long long jlong;
#else
typedef __int64 jlong;
#endif
#endif

It work for me and I don't know if the GCC define __STDC_VERSION__.
I took __STDC_VERSION__ from a post on comp.lang.c from 2000/04/26
(Ben Paff).

Can IBM/OTI incorporate this change or something similar that works on
non C99 compilers.

Thanks
FusionFusion

PS: The same should be true for MS VisualC++ 6.0
Updated on 2004-04-26T15:56:54Z at 2004-04-26T15:56:54Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    9394 Posts
    ACCEPTED ANSWER

    Re: long long from jniport.h not allowed in MS eMbedded Visual Tools

    ‏2004-04-23T13:22:12Z  in response to SystemAdmin
    I've been using the eVC++ tools for years to write JNI, and I've never
    encountered this problem. Are you missing a compiler flag?

    Charlie

    "FusionFusion" <FusionFusion@web.de> wrote in message
    news:9f7f0753.0404230339.24e7ef1b@posting.google.com...
    > Hallo,
    > I try to work with jni and use the compiler out of MS eMbedded Visul
    > Tools 3.0.
    > I get an error about long long. Seems the compiler is not C99
    > compatible.
    >
    > I change the jniport.h provided by WSDD 5.6
    > WSDD5.0\ive-2.1\runtimes\pocketpc\arm\ive\bin\include\jniport.h
    >
    > Original:
    > #if defined(QNX)
    > typedef long jlong;
    > #else
    > typedef long long jlong;
    > #endif
    >
    > Changed:
    > #if defined(QNX)
    > typedef long jlong;
    > #else
    > #if __STDC_VERSION__ >= 199901L
    > typedef long long jlong;
    > #else
    > typedef __int64 jlong;
    > #endif
    > #endif
    >
    > It work for me and I don't know if the GCC define __STDC_VERSION__.
    > I took __STDC_VERSION__ from a post on comp.lang.c from 2000/04/26
    > (Ben Paff).
    >
    > Can IBM/OTI incorporate this change or something similar that works on
    > non C99 compilers.
    >
    > Thanks
    > FusionFusion
    >
    > PS: The same should be true for MS VisualC++ 6.0

    • SystemAdmin
      SystemAdmin
      9394 Posts
      ACCEPTED ANSWER

      Re: long long from jniport.h not allowed in MS eMbedded Visual Tools

      ‏2004-04-26T15:56:54Z  in response to SystemAdmin
      Hallo Charlie,
      thank you for the hint. At the begining of the jniport.h file I find
      #if defined(WIN32) || ...
      So I try to find how to change the compiler settings in the eVC++ IDE.
      I go to Project -> Settings -> C/C++ and add "WIN32," in front of the
      Preprocessor definitions. Now there are no complaints about "long
      long".
      The very best is that now there a lib and a exp file generated.
      I don't need this files itself, but it is a good indication that the
      dll
      exports some functions.
      Until now I can only load the dll and call no function
      (UnsatisfiedLinkError).
      The Wizard of Microsoft eMbedded Visual C++ itself pass only
      "WIN32_PLATFORM_PSPC" and "_WIN32_WCE" definitions to the compiler.

      One remark on an older posting from you:
      I add -Djava.library.path=... to the commandline and to the
      jxeLinkOptions.
      I then start the program with the -jxe option. The dll will not be
      loaded because the java.library.path will not be used by the
      classloader.
      The java.lang.ClassLoader use the property
      com.ibm.oti.vm.bootstrap.library.path
      instead of
      java.library.path
      (method loadLibraryWithClassLoader, the loader is null)
      I change the com.ibm.oti.vm.bootstrap.library.path and now my dll was
      found.
      However then the swt libs are not found anymore. Maybe I must then
      also add
      the dll dir of J9 itself. I choose to do not so and add my dll at the
      place
      the J9 dll's are. I am now able to load empty native methodes ;-)

      Thanks a lot
      FusionFusion

      "Charlie Surface" <newsgroup_replies_only_please@nowhere.com> wrote in message news:<c6b5ac$4e8o$1@news.boulder.ibm.com>...
      > I've been using the eVC++ tools for years to write JNI, and I've never
      > encountered this problem. Are you missing a compiler flag?
      >
      > Charlie
      >
      > "FusionFusion" <FusionFusion@web.de> wrote in message
      > news:9f7f0753.0404230339.24e7ef1b@posting.google.com...
      > > Hallo,
      > > I try to work with jni and use the compiler out of MS eMbedded Visul
      > > Tools 3.0.
      > > I get an error about long long. Seems the compiler is not C99
      > > compatible.
      > >
      > > I change the jniport.h provided by WSDD 5.6
      > > WSDD5.0\ive-2.1\runtimes\pocketpc\arm\ive\bin\include\jniport.h
      > >
      > > Original:
      > > #if defined(QNX)
      > > typedef long jlong;
      > > #else
      > > typedef long long jlong;
      > > #endif
      > >
      > > Changed:
      > > #if defined(QNX)
      > > typedef long jlong;
      > > #else
      > > #if __STDC_VERSION__ >= 199901L
      > > typedef long long jlong;
      > > #else
      > > typedef __int64 jlong;
      > > #endif
      > > #endif
      > >
      > > It work for me and I don't know if the GCC define __STDC_VERSION__.
      > > I took __STDC_VERSION__ from a post on comp.lang.c from 2000/04/26
      > > (Ben Paff).
      > >
      > > Can IBM/OTI incorporate this change or something similar that works on
      > > non C99 compilers.
      > >
      > > Thanks
      > > FusionFusion
      > >
      > > PS: The same should be true for MS VisualC++ 6.0