Re: Image Loading Problem on Windows Box



I write:
Instead, install GTK+ (and its dependencies, in case you "install" by
unzipping the separate zip archives for each package) in a folder of
its own (under \Program Files, something Unixish like \opt\gtk+, or
whatever), and just set up your PATH so that your executables will
find the DLLs it needs.

Gavin Keighren writes:
Will the compiled program then know to look in this different location 
for the dlls? Or will each target machine have to have its PATH 
modified?

It's simplest if you have your application's EXE file in the same
"bin" folder where the GLib, GTK+ etc DLLs are. The folder where the
EXE file is is always searched first, before the Windows System32 and
System folders, and the folders in PATH. Thus if you have the
application EXE in the same folder as the DLLs it needs, you won't
have to worry about PATH. (And then use whatever method you prefer, or
your installer-builder provides, to set up the necessary shortcut to
your application in the Start Menu and/or on the Desktop.)

Yeah, I can understand that if your application is just a small single
executable, it might seem like a lot of work to have to build an
installer that also installs GTK+ and its dependencies. You could try
to "piggyback" you app on some of the existing GTK+ installers.

There are various opinions whether it makes sense to try to use a
shared GTK+ installation for different applications on Windows or
not. My personal opinion is that at it is definitely safest if each
GTK+ application has its own bundled installation of GTK+ that it is
known to work with. But yeah, for small apps this does feel a bit
silly.

Ideally, I would prefer the end users to not have to do anything other 
than copy and run the executable. Would statically linking the GTK 
libraries give me this result?

Statically linking is not easy, and I don't know if anybody has done
it. None of the required libraries are available as prebuilt static
archives as far as I know. You would need to build static archives of
glib, gobject, atk, pangocairo, pangowin32, cairo, gdk-win32,
gtk-win32, gdk-pixbuf and the image loaders you need, libjpeg, libpng,
zlib, libintl, iconv (did I forget some?) and link them into your
executable.

--tml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]