Skip to content

Commit cadda8d

Browse files
authored
fix(cpp): multiversion package support (#1427)
Signed-off-by: Bailey Hayes <[email protected]>
1 parent 5ad77e0 commit cadda8d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

crates/cpp/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use symbol_name::{make_external_component, make_external_symbol};
1212
use wit_bindgen_c::to_c_ident;
1313
use wit_bindgen_core::{
1414
abi::{self, AbiVariant, Bindgen, Bitcast, LiftLower, WasmSignature, WasmType},
15-
uwrite, uwriteln,
15+
name_package_module, uwrite, uwriteln,
1616
wit_parser::{
1717
Alignment, ArchitectureSize, Docs, Function, FunctionKind, Handle, Int, InterfaceId,
1818
Resolve, SizeAlign, Stability, Type, TypeDef, TypeDefKind, TypeId, TypeOwner, WorldId,
@@ -741,9 +741,11 @@ fn namespace(resolve: &Resolve, owner: &TypeOwner, guest_export: bool, opts: &Op
741741
TypeOwner::World(w) => result.push(to_c_ident(&resolve.worlds[*w].name)),
742742
TypeOwner::Interface(i) => {
743743
let iface = &resolve.interfaces[*i];
744-
let pkg = &resolve.packages[iface.package.unwrap()];
744+
let pkg_id = iface.package.unwrap();
745+
let pkg = &resolve.packages[pkg_id];
745746
result.push(to_c_ident(&pkg.name.namespace));
746-
result.push(to_c_ident(&pkg.name.name));
747+
// Use name_package_module to get version-specific package names
748+
result.push(to_c_ident(&name_package_module(resolve, pkg_id)));
747749
if let Some(name) = &iface.name {
748750
result.push(to_c_ident(name));
749751
}

crates/test/src/cpp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ impl LanguageMethods for Cpp {
4949
"async-trait-function.wit"
5050
| "error-context.wit"
5151
| "futures.wit"
52-
| "multiversion"
5352
| "resources-with-futures.wit"
5453
| "resources-with-streams.wit"
5554
| "streams.wit" => true,

0 commit comments

Comments
 (0)