diff --git a/README.md b/README.md index 68039a8..6860ba0 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ To include `xdagj-native-randomx` in your project, add the following dependency io.xdag xdagj-native-randomx - 0.2.2 + 0.2.3 ``` diff --git a/pom.xml b/pom.xml index 460c9fc..e7908c7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.xdag xdagj-native-randomx - 0.2.2 + 0.2.3 xdagj-native-randomx A Java RandomX Library For XDAGJ diff --git a/src/main/java/io/xdag/crypto/randomx/RandomXLibraryLoader.java b/src/main/java/io/xdag/crypto/randomx/RandomXLibraryLoader.java index fa93b89..5c051d9 100644 --- a/src/main/java/io/xdag/crypto/randomx/RandomXLibraryLoader.java +++ b/src/main/java/io/xdag/crypto/randomx/RandomXLibraryLoader.java @@ -138,11 +138,22 @@ private static File extractAndLoadNativeLibrary() throws IOException, IllegalSta } String mappedLibName = System.mapLibraryName(libraryLogicalName); - String tempFilePrefix = mappedLibName.substring(0, mappedLibName.lastIndexOf('.')); - String tempFileSuffix = mappedLibName.substring(mappedLibName.lastIndexOf('.')); + File tempFile; + + if (os.contains("win")) { + // Use a fixed file name under Windows: randomx.dll + Path tempDir = Files.createTempDirectory("randomx-"); + tempDir.toFile().deleteOnExit(); + tempFilePath = tempDir.resolve("randomx.dll"); // Fixed name + } else { + // Linux and macOS uses the default temporary files policy + String tempFilePrefix = mappedLibName.substring(0, mappedLibName.lastIndexOf('.')); + String tempFileSuffix = mappedLibName.substring(mappedLibName.lastIndexOf('.')); + tempFilePath = Files.createTempFile(tempFilePrefix + "-", tempFileSuffix); + } + + tempFile = tempFilePath.toFile(); - tempFilePath = Files.createTempFile(tempFilePrefix + "-", tempFileSuffix); - File tempFile = tempFilePath.toFile(); tempFile.deleteOnExit(); Files.copy(libStream, tempFilePath, StandardCopyOption.REPLACE_EXISTING); diff --git a/src/main/resources/native/librandomx_linux_x86_64.so b/src/main/resources/native/librandomx_linux_x86_64.so index 62637c6..b183a68 100644 Binary files a/src/main/resources/native/librandomx_linux_x86_64.so and b/src/main/resources/native/librandomx_linux_x86_64.so differ diff --git a/src/main/resources/native/librandomx_macos_x86_64.dylib b/src/main/resources/native/librandomx_macos_x86_64.dylib index b2f6aab..beb33e7 100644 Binary files a/src/main/resources/native/librandomx_macos_x86_64.dylib and b/src/main/resources/native/librandomx_macos_x86_64.dylib differ diff --git a/src/main/resources/native/librandomx_windows_x86_64.dll b/src/main/resources/native/librandomx_windows_x86_64.dll index a624f27..13aac24 100644 Binary files a/src/main/resources/native/librandomx_windows_x86_64.dll and b/src/main/resources/native/librandomx_windows_x86_64.dll differ