diff --git a/App/lib/core/builtin/ViperBuild.vp b/App/lib/core/builtin/ViperBuild.vp index aec2135..829f855 100644 --- a/App/lib/core/builtin/ViperBuild.vp +++ b/App/lib/core/builtin/ViperBuild.vp @@ -1056,9 +1056,10 @@ def _HandleCDLL(node: ast.AST*, handle: str) -> int: VLogger.error("ffilib: CDLL(path) needs a constant runtime=True/False, or use Project.StaticLib/DynamicLib", "ffilib") return 1 if rt == 1: - rc_d: int = _AppendLibPath(1, c1.str_val) - if rc_d == 0: _RegisterFfiHandle(handle, 1, c1.str_val) - return rc_d + # runtime=True:不进链接输入(运行期由 thunk 用绝对路径 LoadLibraryA), + # 只登记句柄与路径;否则会同时生成导入表依赖,与 thunk 重复。 + _RegisterFfiHandle(handle, 1, c1.str_val) + return 0 rc_s: int = _AppendLibPath(0, c1.str_val) if rc_s == 0: _RegisterFfiHandle(handle, 0, c1.str_val) return rc_s @@ -1443,7 +1444,7 @@ def DiscoverAndApply(mb: memhub.MemBuddy*, entry_path: str) -> int: """Pass 0 for --src: discover and apply viperbuild config; 0=success, else failed.""" global _scratch, _work, _visited, _pending, _proj_vars, _entry_dir, _applied global _search_dirs - global _ffi_handles_names, _ffi_handles_rt + global _ffi_handles_path, _ffi_handles_names, _ffi_handles_rt if mb is None or entry_path is None: VLogger.error("viperbuild: argument is null", "viperbuild")