building an MSVC app with libpurple

David Byron dbyron at dbyron.com
Fri May 25 12:39:10 EDT 2007


On Friday, May 25, 2007 @ 6:51a, Daniel Atallah wrote:

> On 5/25/07, Lee Roach <phroggster at gmail.com> wrote:
>
> > You should not need to rename any of the files extracted
> > from Tor's zips or built by libpurple.
> 
> This is exactly right - Tor's dev package already contains
> a MSVC link library (glib-2.0.lib).

And there was much rejoicing.  The combination of:

http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.12/glib-2.12.11.zip

with

http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.12/glib-dev-2.12.11.zip

has everything I need.  I've got libpurple.lib and glib-2.0.lib in my link
line and all the directories with libglib-2.0-0.dll, etc. in my path and my
MSVC-linked nullclient builds and runs.  I don't think it's working but
that's a different story.  I need to make sure I know what it's supposed to
be doing first :)

> > The thing Daniel hasn't mentioned, which I meant to
> > reply to your first post on earlier but ran into more
> > pressing problems, is that you'll need to make sure to
> > inform your program on where to load load
> > libglib-2.0-0.dll from. See pidgin/win32/winpidgin.c for
> > an example of how to do it properly.
> >
> > Simply query the registry at
> > {hklm|hklu}\SOFTWARE\GTK\2.0\Path to determine the
> > installed GTK runtime path, and SetDllDirectory (if
> > available, otherwise SetCurrentDirectory) with that
> > result plus "\\bin".  Having never used nullclient, I'm
> > not sure where that'll need to be added, but it'd have
> > to be called before any code references functions that
> > are exported by glib. In other words, before using
> > init_libpurple() or any glib calls, make sure the OS
> > knows where it and it's dependencies can be loaded from.
> 
> I actually purposefully didn't mention this because I
> don't think that it is the right solution for a native
> client.  There are far fewer dependencies for libpurple
> than Pidgin and there is no need for a libpurple client to
> depend on the GTK+ runtime.  It would make more sense to
> use a local copy of the appropriate dependencies and not
> have to worry about installing them separately.

I didn't have to do this and things seem to be working as far as finding
functions from libraries, etc.  I'm not sure I won't be bitten by Visual
Studio 6 (Tor's stuff) vs. Visual Studio 8 (my stuff) mismatches but so far
so good.

I'd be happy to write something for
http://developer.pidgin.im/wiki/BuildingWinPidgin or some other page
describing what I did if people are interested.  If someone with commit
access is interested in making the changes I mentioned in my first note
(extra args in libpurple/Makefile.mingw to create the .def file and an
#ifdef HAVE_UNISTD_H wrapper around #include <unistd.h> in prpl.h), things
would be easier for the next person.

Thanks again for all of your help.

-DB





More information about the Devel mailing list