Description
We have this longstanding issue that if any JS function is to depend on a C function which is not depended on to by any other C function, one will need to add an explicit dependency between that JS and C function in the file tools/deps_info.py
in the form
'javascript_function_name': ['c_function_name'],
Would it be possible for us to switch to a model where in the JS libraries, we'd annotate with a foo__cdeps: ['malloc', 'free']
directive all the C functions that the given JS function depends on?
The way this would work is that the all the JS library functions would be parsed for their cdeps
directives beforehand so we'd know which C functions to keep alive for the build?
That way we'd be able to delete the file tools/deps_info.py
, and have user JS libraries live at the same expressiveness level as system JS libraries are.
E.g. currently in my WebGPU bindings library project, I want to depend on function malloc()
from my JS library function wgpu_shader_module_get_compilation_info_async()
.
The WebGPU bindings library is a general library, and I don't know if the application itself will depend on malloc()
or not. The demos in that repository do not. So in order to make the library work, I need to edit tools/deps_info.json
to add the malloc()
dependency in there - but I couldn't ask users to have to modify their Emscripten installations in order to be able to use the WebGPU library.
A wgpu_shader_module_get_compilation_info_async__cdeps: ['malloc'],
directive would fix this issue cleanly?