Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

JNI: Transforming primitive types

Thread view: 
Marcelo - 19 Jan 2006 22:47 GMT
Hi everybody,

I would like to know if there is simple way in JNI to pass a float** in c++ to a
jobjectArray.

should I first search the jclass element, then creating the NewObjectArray and
at the end, coping all the c++ float-elements to the jobjectArray?

is there a simplest and low ressource-consuming way?

thanks a lot,

Marcelo
Gordon Beaton - 20 Jan 2006 08:00 GMT
> I would like to know if there is simple way in JNI to pass a float**
> in c++ to a jobjectArray.
[quoted text clipped - 4 lines]
>
> is there a simplest and low ressource-consuming way?

Except for the fact that a float array is a more suitable structure
for holding floats than an Object array is, you've described an
appropriate method. What problems are you having?

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

Marcelo - 21 Jan 2006 10:37 GMT
hi,
my problem is that i don't understad if this senteces is OK:

float *vectA; //Some values inside vectA
...
jfloatArray jarr;  //After initialize jarr with float class
...

(*env)->SetIntArrayRegion(env, jarr, 0, 100, vectA);

does it work?

Is there any problem passing floats in c to the jfloats in Java?

Should I do any conversion as we do in Strings?

thanks a lot,

Marcelo
Gordon Beaton - 23 Jan 2006 06:57 GMT
> my problem is that i don't understad if this senteces is OK:

Are you having specific problems, or are you just wondering?

> float *vectA; //Some values inside vectA
> ...
[quoted text clipped - 8 lines]
>
> Should I do any conversion as we do in Strings?

If you want to store floats in a float (not Float) array, pass vectA
to SetFloatArrayRegion (*not* SetIntArrayRegion). Note that float is
not, as you imply, a class.

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.