Skip to content

Import attribute #68

Closed
Closed
@Jiboo

Description

@Jiboo

Hello,

As there is a reflection about a dedicated export attribute in #64, I wondered if there would be any interest for an import attribute?

With a string argument, it may allow imports from multiple modules/host-namespaces, lifting the restriction on --allow-undefined-file to import only from "env".
It would make it more convenient for embeders to specify their API, and users to compile against it.

// env.h
__attribute__((wasm_import("env"))) void print_i32(int32_t);
__attribute__((wasm_import("env"))) void print_i64(int64_t);
...

// test.c
#include <env.h>
__attribute__((wasm_export)) void hello() { print_i32(789); }

Thanks,
JB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions