Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbf4dac

Browse files
committed
Clazz._loadWasm fix ensures com.sun.jna.Pointer creation
1 parent 1857c37 commit cbf4dac

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250322145817
1+
20250326134231
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250322145817
1+
20250326134231

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ Clazz.new_ = function(c, args, cl) {
722722
return obj;
723723
}
724724

725+
Clazz._Pointer = null;
726+
725727
Clazz._loadWasm = function(cls, lib){
726728
if (cls.wasmLoaded)
727729
return;
@@ -858,6 +860,9 @@ Clazz._loadWasm = function(cls, lib){
858860
var retType = "number";
859861
switch (jsm.nativeReturn) {
860862
case "com.sun.jna.Pointer":
863+
if (!Clazz._Pointer) {
864+
Clazz._Pointer = Clazz.load("com.sun.jna.Pointer");
865+
}
861866
fret = retPtr;
862867
break;
863868
case "[B": // It is assumed these are strings
@@ -903,7 +908,6 @@ Clazz._loadWasm = function(cls, lib){
903908
cls.wasmInitialized = true;
904909
J2S.wasm[libName].$ready = true;
905910
}
906-
// may have been preloaded by other JavaScript
907911
var module = J2S[libName + "_module"]
908912
if (module)
909913
f(module);

0 commit comments

Comments
 (0)