Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Objects in native method

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we pass Objects like Hashtable,Vecor in a native method and how to access these java Objects in C program.
eg:
public native void createTest(Hashtable ht,Vector vect);
How to get the access to ht and vect in C Program Implementation of this method
createTest.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are passed to the native methods as instances of "jobject", an opaque data type representing any Java object. You have to call the various methods of the JNI API to work with them. Have a look at the Sun tutorial on the subject
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks But how the jobject in C will handle.....is the same syntax as in java??
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ernest any solution for this???
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already answered this when I said

You have to call the various methods of the JNI API to work with them.

In other words, no, not the same syntax as Java.
Please go read the tutorial I referred you to. It will explain this in detail.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!