https://bugs.llvm.org/show_bug.cgi?id=41610

            Bug ID: 41610
           Summary: Importing mutable global in WebAssembly
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: m...@joachim-breitner.de
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

I am trying to create a shared webassembly library from C code, and compiling
the  C file with `-fpic` and linking with `--shared` looks promising.

I want to import a mutable global from the host environment. My first attempt
was to write

    extern int imported_global;

and that indeed causes

    (import "GOT.mem" "imported_global" (global $gimport$4 i32))

but it turns out that this imports not a global that it reads from and writes
to, but rather a global that it takes a memory address from.

(This is not completely surprising; after all I might want to take the address,
&imported_global).

Is there a way to import, read and write a WebAssembly global from C code?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to