I agree with Software Monkey , but I have one very important addition related to the function name. The function name in the source library must begin with ' _Java_ '. In your case, it should be:
_Java_com_mycompany_stuff_doSomething
I found this by accident and spent two days figuring out why the JVM cannot find the function in the DLL, if any. In my case, javah generates a header file with the name of the function without an underscore before "Java_". So I had to update it manually to make it work.
I wonder why he didn’t mention the underscore prefix in the “Guide and Specification for Java Programmers”, “Java Native Interface 6.0 Specification,” which comes with Java 6 documentation (I worked with jdk 1.6.0_30, but the JDK version should not be problem) and some other resources.
source share