Hi,
I have a C++ DLL, .lib & .h file.
I need to call the C++ functions that are in the DLL from my Java program.
I've heard about JNI and a native keyword in Java, but I haven't been able to find any comprehensive examples...
For simplicity, lets assume I want to call the following WinAPI function:
Header: Declared in Winreg.h; include Windows.h.
Library: Use Advapi32.lib.
What's the easiest way to call this function from a Java program?
I guess the most confusing thing for me is how to represent C++ pointers & references in Java?
In Java, Strings are classes, but in C/C++ they are pointers to arrays of bytes. Also, phkResult is an output parameter passed as a pointer; would that cause any problems?
I have a C++ DLL, .lib & .h file.
I need to call the C++ functions that are in the DLL from my Java program.
I've heard about JNI and a native keyword in Java, but I haven't been able to find any comprehensive examples...
For simplicity, lets assume I want to call the following WinAPI function:
Code:
LONG RegOpenKeyEx( HKEY hKey,
LPCTSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult );
Library: Use Advapi32.lib.
What's the easiest way to call this function from a Java program?
I guess the most confusing thing for me is how to represent C++ pointers & references in Java?
In Java, Strings are classes, but in C/C++ they are pointers to arrays of bytes. Also, phkResult is an output parameter passed as a pointer; would that cause any problems?