Sign in Sign up
kretrod/lodestone-cpp Public
Branches
main
31 lines (28 loc) · 1.2 KB Raw
/*
 * Win32 jni_md.h for cross-compiling.
 *
 * A JDK only ships the jni_md.h for the platform it runs on, so a Linux JDK
 * gives us the Linux one — where `jint` is `int` and the calling convention is
 * empty. Building a Windows DLL against that is a type mismatch waiting to
 * happen, so this supplies the machine-dependent half itself and we point the
 * include path here ahead of the JDK's own include/linux.
 *
 * The contents are fixed by the JNI spec plus the Windows ABI: on LLP64 `long`
 * is 32-bit, which is why `jint` is `long` here and `int` on Linux.
 */
#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_

#define JNIEXPORT __declspec(dllexport)
#define JNIIMPORT __declspec(dllimport)
/*
 * Empty, not __stdcall. x86-64 Windows has a single calling convention, and
 * modern JDKs (this one included) define JNICALL as nothing — jni.h even
 * redefines it unconditionally a few lines after including us, which produced a
 * "JNICALL redefined" warning in every translation unit when this said
 * __stdcall. Matching it keeps the build quiet and the declarations honest.
 */
#define JNICALL

typedef long jint;
typedef long long jlong;
typedef signed char jbyte;

#endif /* _JAVASOFT_JNI_MD_H_ */