If you can call a gtk_* function, it means you’re linking against GTK, which means GTK is available.
What are you actually trying to achieve? If you want to conditionally depend on GTK at run time then you’ll have to use dlopen() and dlsym(), but then you get to dlsym()every single GTK function.
I think you’re overcomplicating and overengineering things. If your application depends on GTK, then you get to depend on GTK.
If you’re distributing a binary, you are also on the hook for distributing its dependencies.
That’s not what “platform agnostic” means.
You should have a build for each platform, if you’re targeting multiple platforms.
If you’re worried about missing dependencies, then you should use something like Flatpak, Snap, or AppImage (with a preference for the former) to ensure you’re bringing your dependencies along.
Are you saying its not possible to build on 1 toolkit environment but run on the mixed one?
I’m targeting multiple platforms - Windows, Linux and Mac
On Windows I’m using MSVC. On Mac - Xcode.
Now on *nix there are 2 environments - GTK-based and QT-based.
Now in *nix world one can have both QT and GTK installed, right?
My program should be smart enough and check what build environment was used. I’m successfully identify whether I build under GTK or Qt and I’m using “–with-qt” to set QT dependency explicitly for configure.
Now if I’m running under environment with both libraries installed I would prefer to follow platform settings.
Lets say I have a KDE with GTK installed. Because of that I set the configure option “–with-qt”, because GTK can be unnstalled at any time. Now when I run it - how do I tell Im running under Qt?
I hope my explanation make sense. Let me know if it doesn’t.