You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CFFI val_ocallN does not match its public argument-vector signature #228
The public CFFI declaration for val_ocallN takes four arguments: object, field id, value pointer array, and argument count. The runtime implementation has only three parameters and treats the pointer-array argument as one Haxe object value.
Regression coverage first: test/regression/CffiObjectCallVector in the existing Main.hx/build.hxml/stdout.txt layout. Resolve val_ocallN through the actual hx_cffi export table and call it using the signature from CFFIAPI.h. Use a native sentinel callback that reports the number of arguments it receives without reading the malformed value. Exercise zero, one and three arguments.
Confirmed on Linux x86_64 with Haxe 4.3.3:
requested 0 arguments, received 1
requested 1 arguments, received 1
requested 3 arguments, received 1
The one-argument case matching by count does not establish correctness: it receives the value-array address rather than the array's element. The sentinel deliberately does not dereference that value.
include/hx/CFFIAPI.h declares:
DEFFUNC_4(value,val_ocallN,value,int,value *,int)
src/hx/CFFI.cpp implements:
hx::Object *val_ocallN(hx::Object *arg1, int arg2, hx::Object *arg3)
It then dispatches the field with __run(Dynamic(arg3)) on API levels below 500, or a single-argument invoker call on API level 500. It never reads the argument count or packs the value vector. hx_cffi returns that implementation under the public val_ocallN name.
Make the implementation match the exported declaration and dispatch the requested argument vector, as val_callN does. Test argument contents, zero arguments, larger arities, thrown callbacks and null receivers. Include both static-link and dynamically resolved calls so declaration/export drift is caught. The current functional reproduction is API level 430; the API level 500 branch has the same source-level mismatch but was not executed in this probe.
This affects native extensions calling object fields through CFFI. No runtime implementation changes are included.
Activity
Pass val_ocallN's argument vector to the field