How this works:
1) At runtime build time, we receive a transport package with the ICU libraries and data (icudt.dat and friends).
2) We package the data file into a static library with some inline assembly magic. We add a bit of code to the shim to locate the symbol in this static library, and tweak the CoreLib code to invoke that path on NativeAOT+WASM.
3) We package all of the resulting ICU static libraries into the runtime package, just like libSystem.Native.a and friends.
4) We link in the necessary pieces with the usual mechanism.
Overall few changes are required, but this is notably different from what Mono does, which runs some code at runtime startup that locates the ICU data (either by downloading it, or from the file system, or from the single-file bundle). It means that our DotNetJsApi case will still use the static data, but do that startup thing too. We can cross the bridge of reconciling these two approaches once DotNetJsApi gets a little more mature.
Another part not yet working is the time zone data, which uses Mono-specific bundling mechanism. It is the last undefined symbol for HelloWasm targeting WASI, I will tackle it separately (in #2491).
How this works: 1) At runtime build time, we receive a transport package with the ICU libraries and data (
icudt.dat
and friends). 2) We package the data file into a static library with some inline assembly magic. We add a bit of code to the shim to locate the symbol in this static library, and tweak the CoreLib code to invoke that path on NativeAOT+WASM. 3) We package all of the resulting ICU static libraries into the runtime package, just likelibSystem.Native.a
and friends. 4) We link in the necessary pieces with the usual mechanism.Overall few changes are required, but this is notably different from what Mono does, which runs some code at runtime startup that locates the ICU data (either by downloading it, or from the file system, or from the single-file bundle). It means that our
DotNetJsApi
case will still use the static data, but do that startup thing too. We can cross the bridge of reconciling these two approaches onceDotNetJsApi
gets a little more mature.Another part not yet working is the time zone data, which uses Mono-specific bundling mechanism. It is the last undefined symbol for
HelloWasm
targeting WASI, I will tackle it separately (in #2491).