Page 1 of 1

Importing webkit or any lib function

Posted: Sun Sep 16, 2018 1:47 pm
by Justin
I want to use WebKitUserContentManager functions:
https://webkitgtk.org/reference/webkit2 ... nager.html

For example webkit_user_content_manager_new()
after sudo apt-get install libwebkitgtk-3.0-dev
i tried:

Code: Select all

importc "-lwebkitgtk-3.0"
webkit_user_content_manager_new_() as "webkit_user_content_manager_new"
endimport
but the compiler throws undefined reference to webkit_user_content_manager_new
i guess -lwebkitgtk-3.0 is not the right lib?

Re: Importing webkit or any lib function

Posted: Sun Sep 16, 2018 3:16 pm
by Justin
i also tried:
sudo apt-get install libwebkit2gtk-3.0-dev

Code: Select all

ImportC "-lwebkit2gtk-3.0"
 webkit_user_content_manager_new()
EndImport
with the same results.
any hints?

Re: Importing webkit or any lib function

Posted: Mon Sep 17, 2018 8:34 am
by Shardik
WebKitUserContentManager is a class of WebKit2GTK+ and is not contained in WebKitGTK. Therefore you have to use WebKit2GTK.

While WebKitGTK+ can be compiled against either GTK+2 or GTK+3, WebKit2GTK depends solely on GTK+3 and the most current library filename is libwebkit2gtk-4.0.so. So in order to execute functions of the WebKitUserContentManager, you should install the developer version of libwebkit2gtk-4.0:
sudo apt-get install libwebkit2gtk-4.0-dev
After the installation of the developer version the following import and function call works on my Xubuntu 18.04 x86 with Xfce:

Code: Select all

ImportC "-lwebkit2gtk-4.0"
  webkit_user_content_manager_new()
EndImport

Debug webkit_user_content_manager_new()
If you should still have difficulties: it's always easier to help if you would state your Linux distribution and desktop environment... :wink:

Re: Importing webkit or any lib function

Posted: Mon Sep 17, 2018 2:06 pm
by Justin
Hi shardik, that did it, thanks!

At least in xfce last version, in an old Mint 17 mate i still get a linker error, i have probably messed up that distro, i will update.

Re: Importing webkit or any lib function

Posted: Mon Sep 17, 2018 2:52 pm
by Shardik
I have just also tried it on an Ubuntu MATE 16.04 x86 with Mate and Linux Mint 18.3 x64 'Sylvia' with Cinnamon. After installing libwebkit2gtk-4.0-dev as described above the import worked like a charm.