[cairo] Hello, Cairo! Re: Simple Win32 GDI example with Cairo wanted

Tor Lillqvist tml at iki.fi
Wed Sep 3 08:15:07 PDT 2008

> The only one I've found is the one referenced at cairographics.org (http://inkscape.modevia.com/win32libs).

There are also precompiled Win32 cairo binaries (built by me) at
(runtime files) and
(developer files). This developer package contains also a .lib format
import library.

(Although as such, import libraries for C APIs should be compatible
between mingw and MSVC, one should be able to copy a .dll.a file to a
.lib file or vice versa. At least, in theory. I haven't verified this

I don't know what the difference beween the Inkscape cairo build and
mine is. They might differ in surface backends provided, for instance,
or in how they link to external libraries. Mine requires the
libpng-1.2.29 runtime (libpng12-0.dll) and zlib-1.2.3 runtime
(zlib1.dll), both available in the same folder. (The zlib is jus a
repackaging of the official zlib DLL.)

> That has cairo-1.6.4-mingw.tar.gz that seems to be MSYS-based

"MSYS-based" is misleading. The organisation of the files is
Unix-inspired, yes. And MSYS is the preferred Unix-like development
environment to use when using mingw (i.e. gcc and the GNU toolchain)
on Windows.

But the run-time files, i.e. the DLL, in the above-mentioned packages
can be used without any MSYS present. And also the developer files,
i.e. headers and import libraries, can be used without any MSYS

> (has bin/libcairo-2.dll, lib/libcairo.la, lib/libcairo.dll.a).  These are
> useless from VC++, right?

The .la file is mostly useless in all cases, IMHO .la files should
never be distributed. The DLL should be usable very nicely from
MSVC-compiled code as the cairo API is plain C and passes no
references to data (like file descriptors) that would be specific to
the C runtime used (my cairo DLL uses msvcrt.dll, and code built by
recent MSVS versions use compiler version specific C runtimes).

And as I said, in theory it should be possible to just copy the
libcairo.dll.a import library to a cairo.lib. Or more reliably, use
some suitable tool (pexports or link -dump -exports) to list the entry
points in the DLL, edit that into a .def file, and generate the import
library with lib.exe yourself. Or just use the import library from my
developer package.


More information about the cairo mailing list