You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add WebAssembly support for C/C++ FFI and CI validation (#29)
* feat: add WebAssembly support for C/C++ FFI and CI validation
* feat: update roadmap and documentation for WASM & no_std support in versions 1.1.0 & 1.1.1
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,19 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
## [1.1.1] - 2026-07-14
6
+
7
+
### Added
8
+
-**WebAssembly Support for C/C++ FFI**: Enabled compilation of the `tinyxml2-capi` FFI bindings crate for `wasm32-unknown-unknown` and `wasm32-wasip1` targets. C and C++ projects compiled to WebAssembly (via Emscripten or WASI SDK) can now link with the static library (`libtinyxml2_capi.a`) as a drop-in replacement.
9
+
-**CI Validation for C/C++ WASM**: Added automated GitHub Actions check to compile `tinyxml2-capi` for WASM targets.
10
+
-**WASM FFI Integration Guide**: Added detailed compilation and linking instructions for Emscripten (`emcc`) and WASI SDK (`clang`) under `docs/architecture/wasm.md`.
11
+
12
+
## [1.1.0] - 2026-07-01
13
+
14
+
### Added
15
+
-**`no_std` Support**: Added `no_std` support with `alloc` allocator feature-gated for resource-constrained environments.
16
+
-**Rust WASM Support**: Verified compilation and execution of `tinyxml2` core library under `wasm32-unknown-unknown` and `wasm32-wasip1`.
17
+
-**Abstract I/O**: File operations and stream writers are now feature-gated under the `std` feature.
Enable tinyxml2-rs to run in resource-constrained embedded environments and web browsers.
315
315
316
-
### Key Deliverables
316
+
### Key Deliverables (v1.1.0)
317
317
-[x]**no_std compatibility** — Feature-gate standard library dependencies and use the `alloc` crate for all dynamic memory allocations (`Vec`, `String`, `Box`). Target: `#![no_std]` with `extern crate alloc`.
318
318
-[x]**WASM target support** — Validate the core crate on `wasm32-unknown-unknown` and `wasm32-wasip1`. JavaScript bindings are intentionally left to the host application boundary; see `docs/architecture/wasm.md`.
319
319
-[x]**Abstract I/O** — Gate file/stream writers behind the `std` feature and keep the core parser, DOM, and string serialization available without `std::io::Write`.
320
320
321
+
### Key Deliverables (v1.1.1)
322
+
-[x]**C/C++ FFI WASM Support** — Support compiling and linking the FFI bindings (`tinyxml2-capi`) on `wasm32-unknown-unknown` and `wasm32-wasip1` targets for C/C++ WebAssembly integration.
Copy file name to clipboardExpand all lines: docs/architecture/wasm.md
+59-3Lines changed: 59 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,18 +88,74 @@ feature. Validate no_std support with `--lib`, or from a consumer crate that
88
88
supplies the allocator, panic strategy, and host boundary required by that
89
89
environment.
90
90
91
+
## C and C++ WebAssembly Support
92
+
93
+
The C FFI compatibility layer (`tinyxml2-capi`) compiles to WebAssembly targets out of the box. C and C++ projects compiled to WebAssembly (via Emscripten or WASI SDK) can link against this compiled Rust artifact as a drop-in replacement.
94
+
95
+
> [!NOTE]
96
+
> The project's CI validates compiling the Rust artifacts (`libtinyxml2_capi.a` and `tinyxml2_capi.wasm`) for WASM targets. Compiling and linking the final C/C++ application remains the responsibility of the consumer's C toolchain (e.g. Emscripten or WASI SDK).
97
+
98
+
When compiled to `wasm32-unknown-unknown` or `wasm32-wasip1`, it generates:
99
+
- A WebAssembly binary (`tinyxml2_capi.wasm`)
100
+
- A static library (`libtinyxml2_capi.a`)
101
+
102
+
### Compiling the C FFI for WebAssembly
103
+
104
+
To compile the C FFI bindings library for WebAssembly:
105
+
106
+
```bash
107
+
# Target the browser / JavaScript environment (e.g. for Emscripten)
-**Shared Memory**: Since Rust and C/C++ compile into a single WebAssembly module when linked statically, they share the same linear memory and allocator (supplied by the C runtime or Rust's target).
143
+
-**String Lifetimes**: Pointers returned by `tx_document_to_string`, `tx_element_name`, or other getters returning `*const c_char` point to UTF-8 C-strings borrowed from the `TxDocument`/`TxPrinter`-owned `CString` caches. Callers **must not free** these pointers. They become invalid as soon as the document is modified (mutated) or when the owning document/printer wrapper is freed.
144
+
91
145
## Validation
92
146
93
-
Use these commands when changing parser, DOM, or serialization code:
147
+
Use these commands when changing parser, DOM, serialization, or FFI code:
0 commit comments