Skip to content

fix: remove usage of platform dependent strlen (#21) #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

thomasdarimont
Copy link
Contributor

@thomasdarimont thomasdarimont commented Apr 4, 2024

Fixes #21 and enables the extism java sdk to be used on windows.

@bhelx
Copy link
Contributor

bhelx commented Apr 4, 2024

I just asked the original reporter to test this on windows. will report back. Thanks again!

@thomasdarimont
Copy link
Contributor Author

I just tested this on windows, and it works fine :)

C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk>ver

Microsoft Windows [Version 10.0.22635.3209]

C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk>java -version
openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk>git branch
* issue/GH-21-avoid-using-strlen
  main

C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< org.extism.sdk:extism >------------------------
[INFO] Building extism 1.0.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ extism ---
[INFO] Deleting C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk\target
[INFO]
[INFO] --- resources:3.3.0:resources (default-resources) @ extism ---
[INFO] skip non existing resourceDirectory C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk\src\main\resources
[INFO]
[INFO] --- compiler:3.10.1:compile (default-compile) @ extism ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 19 source files to C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk\target\classes
[INFO] /C:/Users/tom/dev/repos/gh/thomasdarimont/wasm-dev/extism-java-sdk/src/main/java/org/extism/sdk/HostFunction.java: C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk\src\main\java\org\extism\sdk\HostFunction.java uses unchecked or unsafe operations.
[INFO] /C:/Users/tom/dev/repos/gh/thomasdarimont/wasm-dev/extism-java-sdk/src/main/java/org/extism/sdk/HostFunction.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- resources:3.3.0:testResources (default-testResources) @ extism ---
[INFO] Copying 2 resources
[INFO]
[INFO] --- compiler:3.10.1:testCompile (default-testCompile) @ extism ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk\target\test-classes
[INFO]
[INFO] --- surefire:2.22.2:test (default-test) @ extism ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.extism.sdk.ManifestTests
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.655 s - in org.extism.sdk.ManifestTests
[INFO] Running org.extism.sdk.PluginTests
Hello from Java Host Function!
Input string received from plugin, {"count": 4}
Host user data, test, 2
Hello from Java Host Function!
Input string received from plugin, {"count": 4}
Hello from Java Host Function!
Input string received from plugin, {"count": 4}
Host user data, test, 2
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.13 s - in org.extism.sdk.PluginTests
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 15, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) @ extism ---
[INFO] Building jar: C:\Users\tom\dev\repos\gh\thomasdarimont\wasm-dev\extism-java-sdk\target\extism-1.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.287 s
[INFO] Finished at: 2024-04-04T17:26:39+02:00
[INFO] ------------------------------------------------------------------------

@bhelx
Copy link
Contributor

bhelx commented Apr 4, 2024

Awesome! I'll merge and follow up with him then :)

@bhelx bhelx merged commit 5c31fc8 into extism:main Apr 4, 2024
@apisorbust
Copy link

Thank you all for the quick fix/find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnsatisfiedLinkError: Error looking up function 'strlen'
3 participants