• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Java native interface

I'm want to write a gui using java and then use JNI to interface the gui with c++ code. How is the c++ code treated?  Is it treated as part of the java code? Does the c++ code run on it's own stack or does it run on the same stack that the java code is running on?  Will the c++ code be able to store and retreive it's own data structures?
1 Solution

As regarding ur last que,
yes the c++ code can access its data structure and manipulate with it. Ur c++ code can event return data types like string, int, etc

Visit this site for more info


Best of luck
THe C++ code is treated by java as a separate dll functionality code.

It wont be treated as part of java code. example we use functions like printf() . Only the line calling the function belongs to our code.

Since the C++ code is part of the loaded dll, it will run on a separate stack. The c++ code could use all allowed C++ data types internally. But while returning it should return in specific java dependend strings.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now