Originally posted by rami marri:
thanks chandu.
But can any one tell me how the JAVA API calls the native methods and will be implemented them.?
i am some what confusing about native methods , how java can implement these methods internally?
thanks
It's just a different call stack. Normally, methods are compiled to byte codes and it is part of a class. Native methods are different in that they are not directly part of the class -- instead the JVM looks for them, in libraries, which has been loaded eariler.
To write your own native methods, you simply run your java class file (with the native methods specified) through the javah program. This will generate you a C/C++ include file -- which declares the interface for you to code the method in C/C++.
You then compile your function into a share library -- and likely go back to the original class to add a static initializer to load that library.
Henry
[ November 27, 2007: Message edited by: Henry Wong ]