Complete native MSVC DLL loading, C exports and allocator-ownership interoperability
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
Part of #611. Difficulty: **very high**. Audit baseline: master `3950416e` (2026-09-12).
## Current evidence
[tests/codegen_regressions.rs](https://github.com/wavefnd/Wave/blob/3950416efc55cbc5ae7d54535e5a4e8699394ff0/tests/codegen_regressions.rs#L6110) already verifies final DLL/import-library/PDB names, consumer linking and failed replacement preservation. Its DLL uses /NOENTRY and the consumer is inspected as bytes; it does not load and call the DLL natively.
## Scope
Extend the existing working companion-output support into native x64/ARM64 DLL interoperability. Cover exported C functions, import-library consumers, repeated loading/unloading and runtime initialization where used. Validate ownership with allocation/release performed by the owning module; do not promise that arbitrary static-CRT allocations can be freed by another module. Use existing language capabilities rather than adding export or callback syntax here.
## Completion criteria
A native peer loads and calls a Wave DLL and a Wave consumer calls a native peer DLL with checked aggregate/scalar results. Supported static/dynamic runtime combinations have explicit ownership tests and repeated lifetime cycles. Missing DLL/export errors remain observable. Existing atomic companion publication tests continue passing. No libc FFI is added to std/sys to implement the test path; Windows loader APIs and test peers are acceptable.
## Dependencies and boundaries
#498; #615, #616, #617, #613. Completed #536 is the publication foundation, not an open duplicate.
References: [Microsoft guidance on CRT objects across DLL boundaries](https://learn.microsoft.com/en-us/cpp/c-runtime-library/potential-errors-passing-crt-objects-across-dll-boundaries)
Contributor guide
Research direction
Start with tests/codegen_regressions.rs around line 6110 and inspect the existing companion-output support, then review the Windows loader APIs and test peers mentioned in the issue. Extend the native interoperability coverage for x64/ARM64, C exports, loading and unloading, initialization, and module-owned allocation/release. Done means native peers can load and call each other with checked results, ownership and lifetime combinations are tested, errors remain observable, and existing publication tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100