The Visual Studio Library is rarely used for development, and this time it is less efficient to develop with common tools because of a larger requirement, so choose to use Visual Studio for development as follows: Open Visual Studio, select File-> New-> project, select Win32 Project, enter the name of the project, and then click OK, as shown below
Click Next to go to the application settings interface, select DLL and Empty project, and finally click Finish, as shown
To enable the DLL library to access JNI-related header and library files, right-click on the project name and select Properties, as shown below
Popup Project Properties page, as shown below
In the Project Properties page, click Configure properties and select VC + + directory, as shown below
Click Include directory, and select Edit, as shown below
Click Edit to eject the Include Directory dialog box, where the Include directory in the JDK installation directory is included, click OK, as shown
Also, click Reference Directory, select Edit, eject the Reference Directory dialog box, include the Lib directory in the JDK installation directory in the dialog box, click OK, as shown below
When the project properties are configured, click the OK button on the Project property page to exit the Project property page.
Take the JNI header file into the project's header file directory and edit the implementation file in the source file directory, as shown below
Finally, the DLL file is generated, as shown below
The steps above will complete the process of developing the JNI DLL library in Visual Studio and completing the compilation of the 32-bit DLL library. If Java wants to call a 64-bit DLL library, it needs to be configured as follows, select Configuration Manager in the following figure
In the Configuration Manager interface that pops up, click the figure below to select New
To configure the new solution platform that pops up in the following figure, click OK
Set up a 64-bit platform for your project in the Configuration Manager interface and click Close to exit, as shown in the following figure
Finally, rebuild the DLL library for the project, as shown below
That is all the steps in Visual Studio to complete the development of the JNI DLL library and compile it into a 32-bit or 63-bit library.