Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages
Started by Raffi Ismail
Wed, 14 Aug 2002 04:52
Borland C++ Compiler / Java Bug with JNI?
Author: Raffi Ismail
Date: Wed, 14 Aug 2002 04:52
Date: Wed, 14 Aug 2002 04:52
17 lines
1904 bytes
1904 bytes
I have the following code in my Native implementation of some JNI code. A java class needs to call the setInputValues(int, float[]) native function in my DLL.
JNIEXPORT void JNICALL Java_Ryno_setInputValues (JNIEnv *env, jobject obj, jint _n, jfloatArray _v)
{
jfloat *tmp = (*env)->GetFloatArrayElements(env, _v, 0);
for (int i = 0; i < _size_in; i++)
{
inputLayer[i].acc = tmp[i];
}
(*env)->ReleaseFloatArrayElements(env, _v, tmp, 0);
}
Here's the problem, when I compile i get the following: error:Error E2288 J:\C\FeatureMap.hpp 62: Pointer to structure required on left side of -> or ->* in function __stdcall Java_Ryno_setInputValues(JNIEnv_ *,_jobject *,long,_jfloatArray *)
Error E2288 J:\C\FeatureMap.hpp 67: Pointer to structure required on left side of -> or ->* in function __stdcall Java_Ryno_setInputValues(JNIEnv_ *,_jobject *,long,_jfloatArray *)
I know what the error means but this code has been adapted from Sun's tutorials. *env is a pointer, so what happened?
Re: Borland C++ Compiler / Java Bug with JNI?
Author: John McGrath TeamB
Date: Fri, 23 Aug 2002 05:41
Date: Fri, 23 Aug 2002 05:41
24 lines
1701 bytes
1701 bytes
On 13 Aug 2002 21:52:14 -0700, Raffi Ismail wrote:
> JNIEXPORT void JNICALL Java_Ryno_setInputValues (
> JNIEnv *env, jobject obj, jint _n, jfloatArray _v)
> jfloat *tmp = (*env)->GetFloatArrayElements( ...
> I know what the error means but this code has been adapted from
> Sun's tutorials. *env is a pointer, so what happened?
My C++ is rather rusty, but I do not think that is right. "env" is a
pointer to a JNIEnv, so "*env" is a JNIEnv, not a pointer to one. So
I think this should be:
jfloat *tmp = env->GetFloatArrayElements( ...
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads