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?

Path csiph.com!xmission!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail
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 2 Oct 2015 19:38:11 GMT
Organization "JJ's own news server"
Message-ID <mummf3$vjj$1@gonzo.alcatraz> (permalink)
References <muikms0poe@news3.newsguy.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Face ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s;a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W;(T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q;8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^
User-Agent slrn/1.0.2 (Linux)
Lines 35
NNTP-Posting-Host eccf477f.news.astraweb.com
X-Trace DXC=:GKKb9;]WY4B;RYi]PcMG9L?0kYOcDh@:H[iM^\ln3a5KQMXQnOdek:h6SbOcA0WZ1gJ8gR`QCBh1a9V0Ba88bc;A=J5:VE>Y_74`9_`cFg@U:
Xref csiph.com comp.os.linux.development.apps:803

Show key headers only | 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