Skip to content

Splitting WASI into side modules, dynamic linking #13566

Open
@Rochet2

Description

@Rochet2

As it is currently, it seems that applications using dynamic linking are required to place all library code (WASI) to the main module, which then exports functions for the dynamically linked modules.
However, is there any way currently to split WASI into different dynamically loadable modules?
If not, is this something that could be even considered? I see WASI itself has some discussion and changes related to modularity, however, it is unclear if it would allow the implementation to be split into dynamically loaded modules like this.

For example, could I somehow have strcmp and rand be implemented and exported in a side module? Currently trying to use the functions in side modules results in them being imported.

void main() {
    void* str_lib = dlopen("string_lib");
    void* rand_lib = dlopen("rand_lib");
    int (*rand)(void) = dlsym(rand_lib, "rand");
    int (*strcmp)(const char * str1, const char * str2) = dlsym(str_lib, "strcmp");
}
// string_lib; implement and export
int strcmp ( const char * str1, const char * str2 );
// rand_lib; implement and export
int rand(void);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions