|
|
|
|
Re: JNI with Eclipse [message #152764 is a reply to message #152723] |
Tue, 06 April 2004 17:11 |
Bob Messages: 44 Registered: July 2009 |
Member |
|
|
Sam,
This is positively, absolutely NOT a source issue, but here you go. The
ONLY difference between the
CW version that works and this code is that Eclipse will not permit me to
place MyNativeAPI.java in the
default package. The CW version of MyNativeAPI.java is in the default
package.
jni generated .h file:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class MyNativeAPI */
#ifndef _Included_ MyNativeAPI
#define _Included_ MyNativeAPI
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: MyNativeAPI
* Method: MyJNI_Open
* Signature: ([J)J
*/
JNIEXPORT jlong JNICALL Java_ MyNativeAPI_MyJNI_1Open
(JNIEnv *, jobject, jlongArray);
#ifdef __cplusplus
}
#endif
#endif
MyNativeAPI.java:
package com.dog.cat; // changed to protect the innocent, not
present in the CW version
public class MyNativeAPI {
public MyNativeAPI() {
}
/**
* Native Open
*/
public native long MyJNI_Open(long api[]);
}
native .c code
#include <jni.h>
#include "MyNativeAPI.h"
#include <stdio.h>
/*
* Class: MyNativeAPI
* Method: MyJNI_Open
* Signature: ([J)J
*/
JNIEXPORT jlong JNICALL Java_MyNativeAPI_MyJNI_1Open(
JNIEnv *env, jobject jobj,
jlongArray japi)
{
starlic_handle_t* api;
starlic_error_t err;
err = my_open(&api);
if (err == starlic_ok) {
(*env)->SetLongArrayRegion(env, japi, 0, 1, (jlong*)&api);
}
return (jlong)err;
}
Sam Mesh wrote:
> Bob, please send the sources (a reasonable small part of them:)
> --
> Sam Mesh
|
|
|
|
Powered by
FUDForum. Page generated in 0.03634 seconds