[cairo] Re: Linking to Cairo 1.0.2 statically (Win32)

Vladimir Vukicevic vladimirv at gmail.com
Thu Oct 13 14:30:14 PDT 2005


On 10/13/05, Doodle <doodle at scenergy.dfmk.hu> wrote:
> Mike Hearn wrote:
> > On Wed, 12 Oct 2005 15:18:08 +0200, Doodle wrote:
> >
> >>I was speaking about Cairo with one of the Mozilla contributors, and he
> >>said that the main Mozilla guys are quite against building Mozilla in that
> >>way that it would link to Cairo dynamically. They want to link to it
> >>statically, to avoid version mismatch problems.
> >
> >
> > Why can't they just use the cairo.dll.local trick?
>
> I don't know, I'm not one of them, you'll have to convince them,
> not me. :)

We will be supporting linking with a "system" cairo on Linux, assuming
that the system cairo version is at least a version that we specify --
and that'll only be valid for releases/release candidates.  In between
mozilla releases there's no guarantee that anything will work with any
released version of cairo.  We will not support linking with any kind
of system cairo on any other OS, since there will never be a system
cairo on Windows/OSX.

> > Virtually any operating system will let you ship "bundled" DLLs/DSOs which
> > take priority over the system copy whilst still avoiding static linking.
> > Linux lets you, Windows lets you, MacOS X lets you.
> >
> > Is OS/2 really the odd one out in this regard?
>
> No, OS/2 can also do it with some settings. But again, Mozilla
> developers want to link statically, which is problematic with the
> current code version.

It's actually irrelevant for us; we use cairo from a single thread
only, so we currently just use the noop stubs for the mutex functions.

A reasonable suggestion would be a cairo_win32_init() method --
DllMain would call this, and it would be protected by a static int
somewhere to avoid double initialization.  So if you're using a DLL,
you'd notice no change and need to do nothing extra.  If you wanted to
link statically, you would call cairo_win32_init() yourself.  In
practice, an app that might want to link either dynamically or
statically would call cairo_win32_init() at all times, so it's an open
question whether calling it automatically from DllMain() would be a
help or just cause confusion.

    - Vlad


More information about the cairo mailing list