File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 11# Binaryen.NET
22C# Bindings for the Binaryen WebAssembly toolchain.
3+
4+ ## Samples
5+
6+ ### Generating IR -> WAT
7+ ``` CSharp
8+ using (var module = new BinaryenModule ())
9+ {
10+ // Create a simple function body with a single NOP instruction
11+ var body = BinaryenExpression .Nop (module );
12+
13+ // Add a function with no parameters, no return type, and no locals
14+ module .AddFunction (
15+ name : " TestMethod" ,
16+ paramTypes : Array .Empty <BinaryenType >(),
17+ resultType : BinaryenType .None ,
18+ localTypes : Array .Empty <BinaryenType >(),
19+ body : body );
20+
21+ // Emit WAT
22+ Console .WriteLine (module .ToText ());
23+ }
24+ ```
25+
26+ Web Assembly Text (WAT) Output:
27+ ``` WAT
28+ (module
29+ (type $0 (func))
30+ (func $TestMethod
31+ (nop)
32+ )
33+ )
34+ ```
35+
You can’t perform that action at this time.
0 commit comments