From: "BGB" <cr88192@hotmail.com>
To: <java@gcc.gnu.org>
Subject: wrote misc header, JNI wrapper
Date: Sun, 26 Oct 2008 11:30:00 -0000 [thread overview]
Message-ID: <BLU119-DAV1207ACD4E58D57865DFB3E4250@phx.gbl> (raw)
well, I wrote a header, mostly for my own uses, which I will call
'jniwrap.h'.
the purpose is to provide a slightly less ugly interface to the JNI
functions, and also to add consistency between C and C++.
the structure is a big mass of static inline functions which wrap the
various JNI calls.
for example:
(*env)->GetVersion(env); //C
or:
env->GetVersion(); //C++
becomes:
jGetVersion(env); //C & C++
not sure if this is anything anyone would be interested in, I can send the
header if needed (just dunno if these lists like attachments).
start of header (partly reformated for OE-reasons...):
---
#ifndef JNIWRAP_H
#define JNIWRAP_H
#include <jni.h>
#ifdef __cplusplus
#define JNIENV env
#else
#define JNIENV (*env)
#endif
static inline jint jGetVersion(JNIEnv *env)
{ return JNIENV->GetVersion(env); }
static inline jclass jDefineClass(JNIEnv *env, const char *name,
jobject loader, const jbyte *buf, jsize len)
{ return JNIENV->DefineClass(env, name, loader, buf, len); }
static inline jclass jFindClass(JNIEnv *env, const char *name)
{ return JNIENV->FindClass(env, name); }
static inline jmethodID jFromReflectedMethod(JNIEnv *env, jobject mth)
{ return JNIENV->FromReflectedMethod(env, mth); }
static inline jfieldID jFromReflectedField(JNIEnv *env, jobject fld)
{ return JNIENV->FromReflectedField(env, fld); }
static inline jobject jToReflectedMethod(JNIEnv *env,
jclass cls, jmethodID mth, jboolean staticP)
{ return JNIENV->ToReflectedMethod(env, cls, mth, staticP); }
static inline jclass jGetSuperclass(JNIEnv *env, jclass sub)
{ return JNIENV->GetSuperclass(env, sub); }
static inline jboolean jIsAssignableFrom(JNIEnv *env,
jclass sub, jclass sup)
{ return JNIENV->IsAssignableFrom(env, sub, sup); }
..
reply other threads:[~2008-10-26 11:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BLU119-DAV1207ACD4E58D57865DFB3E4250@phx.gbl \
--to=cr88192@hotmail.com \
--cc=java@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).