To implement native methods:
Generate default (template) implementation classes using the -native compiler option. This generates C++ header and source files with a “NativeMethods” suffix. For example, if you compile A.B.MyClass, the generated source file is A_B_MyClassNativeMethods.cpp.
Edit the generated source file, in this case A_B_MyClassNativeMethods.cpp, and add the code to implement the methods.
Compile your source files into a DLL or shared library. On Windows, the easiest way to do this is to use the -dll option on the jnicc command line. On other systems, invoke your compiler separately afterward.
Load the DLL or shared library from your Java class with a static initializer by calling com.sybase.jni.SystemUtil.loadLibrary, as in the following example. Native methods are registered automatically.
public class MyClass { static { com.sybase.jni.SystemUtil.loadLibrary("MyClass"); } public native void myMethod(); }
To register native methods statically in C++ code, use the following syntax:
A_B_MyClassNativeMethods::__register();
You can find a sample implementation in the EAServer samples/SimpleRowSet directory.