Zig in Depth: Web Assembly (WASM)

Поделиться
HTML-код
  • Опубликовано: 29 ноя 2024

Комментарии • 12

  • @archdria
    @archdria 11 месяцев назад +3

    Great video! I've been working with this stuff for several months now. I wish this video existed back then, I struggled a bit to get all this working.
    One convenient thing I am doing is `lib.rdynamic = true` instead of `lib.export_symbol_names`, since it will export all functions marked with `export` without having to explicitly list them, which is normally what I want.
    And for reference in the future when people move to Zig 0.12.0:
    We won't be using `const lib = b.addSharedLibrary` but `const exe = b.addExecutable` and then setting the `exe.entry = .disabled`.

    • @dudethebuilder
      @dudethebuilder  11 месяцев назад

      Thanks for the great tip on lib.dynamic and the heads-up on what's coming in 0.12. Zig keeps moving in fast forward! lol

    • @andrescarignano2691
      @andrescarignano2691 29 дней назад

      thank you so much for this! I was stuck

  • @emilkje
    @emilkje 2 месяца назад

    Very helpful content, Dude! Hope the zig team will move towards wasip2 as well. BTW, do you remember which color theme you are using in your editor here?

    • @dudethebuilder
      @dudethebuilder  2 месяца назад +1

      Thanks! It's tokyonight . Specifically the tokyonight-night variant bundled in the theme. I find it easy on the eyes. :^)

  • @nilslice
    @nilslice 11 месяцев назад +3

    Really great walkthrough! Would love to know what you think of Extism btw, which has great Zig and JS support.

    • @dudethebuilder
      @dudethebuilder  11 месяцев назад +2

      Wow, never heard of Extism but just took a quick look and it looks very interesting indeed. Thanks for letting me know!

  • @jedisct1
    @jedisct1 7 месяцев назад

    Great walkthrough!

  • @klmcwhirter
    @klmcwhirter 11 месяцев назад +3

    wasm32-wasi seems to work fine for me both in node and in the browser (firefox on Fedora 39). Is that not expected?
    when I use wabt to generate the wat file it shows the same exact code for .ReleaseSmall whether I target wasm32-wasi or wasm32-freestanding.
    Anybody else see something different?

    • @dudethebuilder
      @dudethebuilder  11 месяцев назад +2

      If the functions in the library don't do anything specific to WASI like I/O or other system calls, I think the generated WASM modules will indeed be the same. They're just pure functions which behave the same in all host environments.