Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #803

Re: Beyond gtk_init_check() - how do I tell if GTK is installed?

From Jasen Betts <jasen@xnet.co.nz>
Newsgroups comp.os.linux.development.apps
Subject Re: Beyond gtk_init_check() - how do I tell if GTK is installed?
Date 2015-10-02 19:38 +0000
Organization "JJ's own news server"
Message-ID <mummf3$vjj$1@gonzo.alcatraz> (permalink)
References <muikms0poe@news3.newsguy.com>

Show all headers | View raw


On 2015-10-01, Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote:
> I've started learning how to write GTK code.  One thing I noticed is
> that where gtk_init() will terminate your program if it can't find a
> display, gtk_init_check() will tell you whether it succeeded and let
> you use other means (e.g. curses or a text-based interface) if not.
> I've written a test program that uses this technique, and it works
> fine - at least as long as GTK is installed.  However, if GTK is
> not installed, my program dies instantly. 

No, it doesn't.  If there's no GTK  /bin/ld.so doesn't even start it.

> I think it's because it
> can't find needed dynamic libraries; however, the machine on which
> I tested it belongs to someone else who's now gone, and all of my
> machines already have GTK installed so I can't easily reproduce the
> condition.

create a chroot environment. or a virtual mchine.

> In a perfect world, gtk_init_check() would contain enough statically
> linked code that it could test for the presence of the GTK libraries
> and return an appropriate error if they're absent.

ld.so checks for the shared libraries before starting your code.

> But I guess I'll
> have to settle for some sort of programmatic test for the existence
> of these libraries that won't nuke my program if they're not there.

yeah, this means you can't link them dynamically, you'll have to do runtime
linking (eg. using dlopen)


-- 
  \_(ツ)_

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Find similar


Thread

Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-01 06:43 +0000
  Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Richard Kettlewell <rjk@greenend.org.uk> - 2015-10-01 09:30 +0100
    Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-01 18:00 +0000
      Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Richard Kettlewell <rjk@greenend.org.uk> - 2015-10-01 19:36 +0100
        Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-01 23:39 +0000
          Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-10-01 19:27 -0600
            Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-02 16:50 +0000
          Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Richard Kettlewell <rjk@greenend.org.uk> - 2015-10-02 09:27 +0100
            Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-02 16:50 +0000
  Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Jerry Peters <jerry@example.invalid> - 2015-10-01 20:12 +0000
    Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-01 23:39 +0000
      Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Jasen Betts <jasen@xnet.co.nz> - 2015-10-02 19:52 +0000
        Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-10-02 20:13 +0000
      Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Jerry Peters <jerry@example.invalid> - 2015-10-02 20:08 +0000
  Re: Beyond gtk_init_check() - how do I tell if GTK is installed? Jasen Betts <jasen@xnet.co.nz> - 2015-10-02 19:38 +0000

csiph-web