npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dylink

v0.14.0

Published

Support for dynamic linking of WebAssembly code via Javascript built using wasm32-unknown-emscripten

Downloads

25

Readme

dylink - WebAssembly dynamic loader for the Zig libc runtime

This is a WebAssembly dynamic loader for the ABI used by emscripten and the llvm backend when targeting emscripten. It runs both on node.js and in the browser. It supports the libc provided by Zig, not emscripten.

How to use this:

When you build your code, you have to link in the static archive file dist/wasm/libdylink.a, and provide some flags:

zig cc -target wasm32-wasi app.c -o build/wasm/app.wasm \
    -L path/to/dist/wasm/ -ldylink \
    -rdynamic -shared -fvisibility=default \
    -Xlinker --import-memory -Xlinker --import-table

Then the following functions will be available to use from app.c:

extern void* dlopen(const char* filename, int flags);
extern void* dlsym(void* handle, const char* symbol);

There are examples in the tests/ subdirectories.

Scope

I care about implementing enough of the linker spec to support loading Python extension modules. In particular, I'm probably not worried about dependencies, i.e., automatically loading all the dynamic libraries that dynamic library depends on.

Why?

There is already code in emscripten itself that fully implements the dynamic loader spec. However, I would like to build and run WebAssembly modules using a lightweight modern toolchain built around Zig instead. It is thus necessary to implement a self-contained dynamic loader.

PR's welcome to implement more!

References

There doesn't seem to be an actual write up of how dynamic linking actually works with WebAssembly, and I think the official WebAssembly project gave up on it in favor of other things that don't exist yet. it got implemented for emscripten (mainly here).