<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Importing mutable global in WebAssembly"
href="https://bugs.llvm.org/show_bug.cgi?id=41610">41610</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Importing mutable global in WebAssembly
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mail@joachim-breitner.de
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>