• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNI and native library environment?  RSS feed

 
Grigory O. Ptashko
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I want to use a library written in C through JNI. As many libraries do, my library must be initialized first before using any functions from it.

For exmaple in C,



The problem is that initialization can take pretty long time to do it in production. So the question is:

Is it somehow possible first to set up the environment (init_lib()) through JNI and then call functions from my lib (also through JNI) so that they execute in this environment and use all already initialized resources?

Any advice would be great!
 
Grigory O. Ptashko
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heh.. Sorry guys. It was kinda wierd question from those that are asked before trying anything. Right after posting I realized that loading a shared object through JNI seems to be simply the same as it is in C or whatever. All static variables are kept somewhere in JVM and library functions use them during all JVM lifetime.


To moderators: you can close this topic, please
 
Henry Wong
author
Sheriff
Posts: 23281
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grigory,

Since you are the original poster for this topic, I believe you can actually close this topic yourself -- not sure. If you like to try, you can click on the close topic button on the bottom of this page.

Personally, I don't see any reason to close this topic -- maybe some other poster want to know some specifics on what you did.

Henry
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!