• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

native keyword ?

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok , I have used the native keyword in java alot when I use the JNI.
What I am trying to understand is if I can use native keyword the same way as c uses extern.
But not having to create a dll or anything just simple load an existing dll and using a particular function in it by looking up that functions mangled name using something like objdump,...etc

The only thing I could see being a problem is if their is parameters to the function.... problems with the type ,size ,...etc with this.
But if the parameters corresponded to the same thing as java parameters then would it work?

Also using gcj to compile java into machine code. If I used the native command would it work like extern to be resolved be the linker ... enabling me to call c/c++ from compiled java into .o files so I can call c without a user defined dll or interface like JNI CNI ,...etc

Anybody know?
What exactly the keyword native gets compiled down to when in a class file and how the JVM translates this into machine code?

basically I have c .o files with functions in them that I would like to call from java. gcj allows me to compile the java into .o files as well and then link to an .exe with all those c .o files. But I want away to call the c function from the java functions in the .exe. I know calling java from c would be as easy as looking up the names with objdump and putting an extern command in my c files before I compile them into .o files. My problem is how to call c from java .o files normal I would use native command and go thru a library but now I am linking to an exe file so all I need is the native command to beable to call back c functions???

That is why I am wanting to know how native works?
 
I've been selected to go to the moon! All thanks to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic