fix •FFI with both a mutated & struct/array argument
This commit is contained in:
parent
d93ec562f3
commit
381c03a456
@ -900,16 +900,14 @@ B libffiFn_c2(B t, B w, B x) {
|
||||
if (resSingle) {
|
||||
for (usz i = 0; i < argn; i++) {
|
||||
BQNFFIEnt e = ents[i+1];
|
||||
B c = buildObj(e, e.mutates, harr_ptr(ffiObjs), &objPos);
|
||||
if (e.mutates) r = c;
|
||||
if (e.mutates) r = buildObj(e, e.mutates, harr_ptr(ffiObjs), &objPos);
|
||||
}
|
||||
} else {
|
||||
M_HARR(ra, mutArgs+(resVoid? 0 : 1));
|
||||
if (!resVoid) HARR_ADDA(ra, r);
|
||||
for (usz i = 0; i < argn; i++) {
|
||||
BQNFFIEnt e = ents[i+1];
|
||||
B c = buildObj(e, e.mutates, harr_ptr(ffiObjs), &objPos);
|
||||
if (e.mutates) HARR_ADDA(ra, c);
|
||||
if (e.mutates) HARR_ADDA(ra, buildObj(e, e.mutates, harr_ptr(ffiObjs), &objPos));
|
||||
}
|
||||
r = HARR_FV(ra);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
%USE defs ⋄ f←@•FFI⟨"&","memcpy","&i8","*i8",size_t∾":u1"⟩ ⋄ F ⟨¯100+↕10, ↕10, size_tw↑0‿0‿1⟩ %% (↕4)∾4↓¯100+↕10
|
||||
%USE defs ⋄ f←@•FFI"&"‿"memcpy"‿"&i16"‿"*i16:i32"‿size_t ⋄ F ⟨¯100+↕10, ⟨123+456×2⋆16, ¯2⟩, 8⟩ %% 123‿456‿¯2‿¯1∾4↓¯100+↕10
|
||||
%USE defs ⋄ f←@•FFI⟨size_t,"strlen","*i8"⟩ ⋄ ⟨⟩ F ⋈1‿2‿3‿0 %% 3
|
||||
|
||||
%USE defs ⋄ f←@•FFI⟨"&","memcpy","&i8","[4]i8",size_t⟩ ⋄ F ⟨10⥊0, 3+↕4, 4⟩ %% 3‿4‿5‿6‿0‿0‿0‿0‿0‿0
|
||||
|
||||
|
||||
# bad array elements
|
||||
|
||||
Loading…
Reference in New Issue
Block a user