如何在Java中调用VB.net函数?我尝试用Java做这个:
import java.util.HashMap;
import java.util.Map;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.win32.StdCallFunctionMapper;
import com.sun.jna.win32.StdCallLibrary;
public class Main2{
public interface Class1 extends StdCallLibrary
{
void fn_Today(int a,int b);
}
public static void main(String[] args)
{
Map options = new HashMap();
options.put(Library.OPTION_FUNCTION_MAPPER, new StdCallFunctionMapper()) ;
Class1 INSTANCE = (Class1) Native.loadLibrary("fn_Today", Class1.class, options);
INSTANCE.fn_Today(0, 0);
}
}
但它返回了这个: enter image description here
VB.Net中的我的代码:
Public Class TestClass
Public Function SumNum(Val1 As Integer, Val2 As Integer)
Dim TVal As Integer
TVal = Val1 + Val2
Return TVal
End Function
End Class