<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64532>64532</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Would it make sense to allow wasm tables to be imported in C?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TerrorJack
</td>
</tr>
</table>
<pre>
Currently, it is possible to import wasm tables in assembly via:
```
.tabletype my_table, externref
.import_module my_table, my_env
.import_name my_table, mt
```
However, it is not possible to do this via C syntax:
```c
extern __externref_t my_table[0] __attribute__((import_module("my_env"), import_name("mt")));
```
The above would fail with both `'import_module' attribute only applies to functions`, `'import_name' attribute only applies to functions` and `WebAssembly table must be static`. And even if I use `__asm__` intrinsics to specify `my_table`, the rest of the C code cannot use it and regards it as an undefined identifier.
Would it make sense to allow wasm tables to be imported in C, given it's already possible to have imported functions?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMGO4zYM_Rr5QmzgkWMnPvgwk0HQ9rzAHg3aomN1ZSkQ6WT994WVzGSzaIsCBQQltPjI954pI7M9eaJGlW-qfM9wljHE5ivFGOIf2H_PumCW5jDHSF7covQBrIBlOAdm2zkCCWCnc4gCV-QJBDtHDNYDMtPUuQUuFlXxqvJ3lX_sVX5fKdwkkCxngmlpU7A2oh9C0Uca7lm3Nu0UzOyeM6elJX95TvM4_ZIkf9v8tv8WrnSh-NDngzxpNAFktLyKgQPw4gV__JOq_hbf-EPbfgpp5cGofMtV-Q5tiyLRdrNQ2yq9V3r_pDM90neBWitdJ44PjfcE-ThMq3j7F61fRwLswoXgGmZnYEDr4GplhC7ICGu23v1CYgefNCF4twCez84Sr9YMs-_FBs8JeXgucKP4X-GA3qz4b9S9foxPsgummQU6AhYU26sq38CrN0AX8mAH-B1mphXZtshT2661rJdoPds-teEz9XZY1pzPd3DjKyNBJBYIQ_p_gD4Ygh79OgRrXSuJWKQTRsMpZEAPszc0WE8GrCEvdrAUNz9b_S0ZbAUm_E7A5DkNEzoXrk_3RcIq7ubZWs7DYaV2skmfKL1jQBcJzfI0liNefoI9rCyOmWkKUxc1ZtS8VPVLmRe6KrKx2dLO7KpdXZgB833R5X2FL1tT43Zv6t7ozDY610W-z_cv2zwvd5u6LPttXe0LrHWFWKttThNat3HuMm1CPGWWeaam2paFzhx25Dh9UbT2dIV0uI5n-Z7FZsV86eYTq23uLAs_qogVR83_8qw4ZnN0zShy5vV66qPSx5OVce42fZiUPq7d7j9fzjH8Sb0ofUwcWelj0vBXAAAA__-cNqjn">