diff --git a/App/lib/core/Gen/Func/FuncGenDef.vp b/App/lib/core/Gen/Func/FuncGenDef.vp index d313c3c..2e9cb84 100644 --- a/App/lib/core/Gen/Func/FuncGenDef.vp +++ b/App/lib/core/Gen/Func/FuncGenDef.vp @@ -767,10 +767,14 @@ novirtual class FuncGenDef(CallGenBase.CallGenBase): if (has_export != 0 or has_state != 0) and trans.ModuleSha1 is not None: self.Gen.CallGenBase.register_cexport_func(trans.ModuleSha1, fd.name) if is_extern_decl != 0: + stdio.printf("[ffiprobe] extern branch '%s' ffi_lib=%s\n", fd.name, "nil" if fd.ffi_lib is None else fd.ffi_lib) + stdio.fflush(None) # extern name(...):runtime=True 在这里也生成 thunk(Phase A 的 extern 往往不走 # forward_declare_functions,两处都挂才覆盖全部路径;另一处靠 find_func_in_module 去重)。 if fd.ffi_lib is not None: ffi_rt_d: int = ViperBuild.FfiHandleRuntime(fd.ffi_lib) + stdio.printf("[ffiprobe] extern '%s' rt=%d\n", fd.name, ffi_rt_d) + stdio.fflush(None) if ffi_rt_d < 0: self.Gen.TypeGenErr.fatal_error(fd, f"extern library handle '{fd.ffi_lib}' is not a ffilib.CDLL binding (declare it with ffilib.CDLL(...) first)", "NameError") return 0 diff --git a/App/lib/core/builtin/ViperBuild.vp b/App/lib/core/builtin/ViperBuild.vp index 3703cdc..1953980 100644 --- a/App/lib/core/builtin/ViperBuild.vp +++ b/App/lib/core/builtin/ViperBuild.vp @@ -988,6 +988,8 @@ def _AssignTargetName(asn: ast.Assign*) -> str: # _HandleCDLL - 按实参形态写入静态/动态库表;list 回退形式本期 fail-fast def _HandleCDLL(node: ast.AST*, handle: str) -> int: """抽取 ffilib.CDLL(...):0=成功""" + stdio.printf("[ffiprobe] _HandleCDLL enter handle=%s\n", "?" if handle is None else handle) + stdio.fflush(None) if node is None or node.kind() != ast.ASTKind.Call: return 0 call: ast.Call* = ast.Call*(node) args: list[ast.AST*]* = call.args