A bit of progress :-) I compiled a shared library libwebview.so on Ubuntu with:
g++ webview.c -fPIC -shared -o libwebview.so `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0`
Before that, the gtk and webkit2 dev libraries should be installed with:
sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev
And if you don���t have gcc tools:
sudo apt install build-essential
I���ll see if I can figure it out for MacOS too.
It appears that in Linux it is necessary to run the webview in separate thread, otherwise Pharo image gets blocked, so I have to slightly change the architecture (with threaded FFI as astares pointed out on Discord #ffi).
Tomaz