Open 59436830 opened 3 years ago
as I understand the c library binary code which including printf.o is not in my wasm file
No, all the C/C++ libraries you use are linked statically and compiled into the wasm file.
as I understand the c library binary code which including printf.o is not in my wasm file
No, all the C/C++ libraries you use are linked statically and compiled into the wasm file.
sorry i cannot understand what you mean completely. maybe I got some wrong information from internet. It's easy to understand how to convert a c source code to WASM, but then c/c++ library are binary code not source code on my machine. you mean the emcc tool chain decompile the printf.o into a intermediate code and link it with my main.c ???
No. Emscripten includes the full source code for libc, libc++ etc. These are compiled for wasm and your computer's normal versions of these libraries are never considered. If you want to use a library that's not included in Emscripten then you have to compile it with emcc yourself.
No. Emscripten includes the full source code for libc, libc++ etc. These are compiled for wasm and your computer's normal versions of these libraries are never considered. If you want to use a library that's not included in Emscripten then you have to compile it with emcc yourself.
thank you very much, buddy. Now I understand what happens in the compilation. A week ago, I planned to convert a native project to a web assembly project, because i want that project become a web browser plugin that works for our web application. in that native project( coded by c) , I use a lot of system call like fork localtime etc. I was wondering that if I can convert them to WASM from source code. Based on your response, seems that I cannot use WA to meet my requirement. because i used too many system APIs and third-party dynamic libraries (.so and .a) in that project. How sad I have been working for this research for a whole week.
@59436830
You can use pthreads (which will use webworkers behind the scene for you) and of course Date Time in WASM.. Forking is not possible. Most of code will work except OS specific like Windows.
i have read the tutorial in official documentation, but cannot figure it out why ws supports c library like glibc stdlibc etc. From the doc I know that
include
int main () { ... printf("helloworld");
.. } my question is why printf works?? as I understand the c library binary code which including printf.o is not in my wasm file.