devxlogo

Using Names for Java Methods that Differ from the Name the DLL Uses

Using Names for Java Methods that Differ from the Name the DLL Uses

You can use a name for a Java method that is different from the name the DLL uses when it exports the function. For example. you may need to conform to naming conventions prescribed by your own site. In that case, just use the @dll.import directive along with the entrypoint modifier.

For example. if you wanted to use the GetSysColor function, but wanted to change the first letter to lowercase, you would include the following:

 /**@dll.import ("USER32",entrypoint="GetSysColor") */  static native int getSysColor(int nIndex); 

The entrypoint modifier has now set up the aliasing for you.

devx-admin

Share the Post: