Hi. I am using ilc with llvm (from componentize-dotnet) on linux to build a wasm executable. I am linking the bc files generated by ilc together with a C-based library (built with emscripten), and am trying to call from C# into C by declaring methods like this:
[RuntimeImport(Path, nameof(CreateWorld))]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern World* CreateWorld();
This works for native excecutables, but in wasm i get a mismatch in calling conventions between emscripten and ilc. ilc seems to add an additional first parameter to each function, which I think is used to manage a shadow stack used by the GC. I have two questions:
(Also, is this the right place for such questions? If not, do you know what is? Thanks!)
it's the right place!
@jonas echterhoff I don't know the answer to that one of the top of my head. @Scott Waye might and there are some folks who maintain that part of the stack in the .net llvm discord channel https://discord.com/channels/143867839282020352/1141126727028985877
Thanks! I'm going on vacation today, but will follow up on discord once I'm back (unless someone here will have the answer until then).
Last updated: Dec 13 2025 at 17:03 UTC