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

Bill Spitzak spitzak at d2.com
Thu Oct 13 17:31:44 PDT 2005


I'm confused as to what the problem is. We are statically linking with 
c++ Windows .lib files and having no trouble with the c++ static 
constructors being called without any special code in our main program. 
Either I am completely misunderstanding the problem here, or cairo could 
put any necessary static constructors into the same place in the library 
that the c++ compiler put the static constructor code.

Vladimir Vukicevic wrote:

> 
> 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.



More information about the cairo mailing list