Importing webkit or any lib function

Linux specific forum
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Importing webkit or any lib function

Post 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?
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Importing webkit or any lib function

Post 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?
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Importing webkit or any lib function

Post 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:
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Importing webkit or any lib function

Post 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.
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Importing webkit or any lib function

Post 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.
Post Reply