RyanLamansky / dotnet-webassembly

Create, read, modify, write and execute WebAssembly (WASM) files from .NET-based applications.
Apache License 2.0
792 stars 73 forks source link

Get name of global variable #64

Closed Dynamu7777 closed 7 months ago

Dynamu7777 commented 7 months ago

Given a Global variable instance(WebAssembly.Global), there doesn't seem to be an existing API to fetch the name of the GlobalVariable.

What's the best way to do this?

RyanLamansky commented 7 months ago

WebAssembly globals don't natively have names: they're accessed by sequential index number. They can optionally be associated with imports and exports, which are a separate data structure that carries a name associated with the index.