diff --git a/crates/cpp/tests/meshless_strings/component_b/Makefile b/crates/cpp/tests/meshless_strings/component_b/Makefile index 9d9dea504..917578e1e 100644 --- a/crates/cpp/tests/meshless_strings/component_b/Makefile +++ b/crates/cpp/tests/meshless_strings/component_b/Makefile @@ -6,7 +6,7 @@ libcomponent_b.a: the_world.o guest.o ar rcvs $@ $^ bindgen: - ../../../../../target/debug/wit-bindgen cpp ../wit --symmetric --wasm64 --format + ../../../../../target/debug/wit-bindgen cpp ../wit --symmetric --new-api --format clean: -rm *~ *.a *.o diff --git a/crates/cpp/tests/meshless_strings/component_b/guest.cpp b/crates/cpp/tests/meshless_strings/component_b/guest.cpp deleted file mode 120000 index f9b4d9b20..000000000 --- a/crates/cpp/tests/meshless_strings/component_b/guest.cpp +++ /dev/null @@ -1 +0,0 @@ -../../native_strings/guest.cpp \ No newline at end of file diff --git a/crates/cpp/tests/meshless_strings/component_b/guest.cpp b/crates/cpp/tests/meshless_strings/component_b/guest.cpp new file mode 100644 index 000000000..e357dbbd3 --- /dev/null +++ b/crates/cpp/tests/meshless_strings/component_b/guest.cpp @@ -0,0 +1,13 @@ +#include "the_world_cpp.h" + +void exports::foo::foo::strings::A(std::string_view x) { + ::foo::foo::strings::A(x); +} + +wit::string exports::foo::foo::strings::B() { + return ::foo::foo::strings::B(); +} + +wit::string exports::foo::foo::strings::C(std::string_view x, std::string_view b) { + return ::foo::foo::strings::C(x, b); +} diff --git a/crates/cpp/tests/meshless_strings/component_b/the_world.cpp b/crates/cpp/tests/meshless_strings/component_b/the_world.cpp index c33d57120..713810a61 100644 --- a/crates/cpp/tests/meshless_strings/component_b/the_world.cpp +++ b/crates/cpp/tests/meshless_strings/component_b/the_world.cpp @@ -68,10 +68,7 @@ extern "C" __attribute__((__export_name__("foo:foo/strings#a"))) void fooX3AfooX2FstringsX00a(uint8_t *arg0, size_t arg1) { auto len0 = arg1; - auto string0 = - wit::string::from_view(std::string_view((char const *)(arg0), len0)); - - exports::foo::foo::strings::A(std::move(string0)); + exports::foo::foo::strings::A(std::string_view((char const *)(arg0), len0)); } extern "C" __attribute__((__export_name__("foo:foo/strings#b"))) void fooX3AfooX2FstringsX00b(uint8_t *arg0) { @@ -89,16 +86,11 @@ fooX3AfooX2FstringsX00c(uint8_t *arg0, size_t arg1, uint8_t *arg2, size_t arg3, uint8_t *arg4) { auto len0 = arg1; - auto string0 = - wit::string::from_view(std::string_view((char const *)(arg0), len0)); - auto len1 = arg3; - auto string1 = - wit::string::from_view(std::string_view((char const *)(arg2), len1)); - - auto result2 = - exports::foo::foo::strings::C(std::move(string0), std::move(string1)); + auto result2 = exports::foo::foo::strings::C( + std::string_view((char const *)(arg0), len0), + std::string_view((char const *)(arg2), len1)); auto const &vec3 = result2; auto ptr3 = (uint8_t *)(vec3.data()); auto len3 = (size_t)(vec3.size()); diff --git a/crates/cpp/tests/meshless_strings/component_b/the_world_cpp.h b/crates/cpp/tests/meshless_strings/component_b/the_world_cpp.h index 4a5792d27..718f3ddfd 100644 --- a/crates/cpp/tests/meshless_strings/component_b/the_world_cpp.h +++ b/crates/cpp/tests/meshless_strings/component_b/the_world_cpp.h @@ -20,9 +20,9 @@ namespace exports { namespace foo { namespace foo { namespace strings { -void A(wit::string &&x); +void A(std::string_view x); wit::string B(); -wit::string C(wit::string &&a, wit::string &&b); +wit::string C(std::string_view a, std::string_view b); } // namespace strings } // namespace foo } // namespace foo