<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Forwarding this so it appears properly in archives.<br>
<br>
<div class="moz-forward-container">-------- Original Message
--------
<table class="moz-email-headers-table" cellpadding="0"
cellspacing="0" border="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
</th>
<td>Re: [cairo] Cairo win32 Static linking</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
<td>Sun, 02 Feb 2014 07:11:38 -0500</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
<td>WC Black <a class="moz-txt-link-rfc2396E" href="mailto:blackwc88@gmail.com"><blackwc88@gmail.com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
<td>John Emmas <a class="moz-txt-link-rfc2396E" href="mailto:johne53@tiscali.co.uk"><johne53@tiscali.co.uk></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Thanks for the response.
The line in src/Makefile.win32:
OBJECTS_STATIC = $(patsubst %cairo-system.obj, %cairo-system-static.obj,
$(OBJECTS))
was not working properly with msys. I had to change it to:
OBJECTS_STATIC = $(patsubst %.obj, %-static.obj, $(OBJECTS))
to get it to compile with the proper definitions. As an aside, what is
STATIC_SOURCES = cairo-system.c for in src/Makefile.win32?
I have been defining CAIRO_WIN32_STATIC_BUILD.
None of this has resolved my issue, however.
And I don't necessarily need a statically linked cairo, but it'd be nice
to have the option.
On 2/2/2014 6:00 AM, John Emmas wrote:
> On 01/02/2014 17:08, WC Black wrote:
>> I'm having trouble linking to cairo-static.
>>
>> I'm on windows compiling with VC. I compiled cairo myself using msys
>> and VC.
>>
>> I get many of these:
>> error LNK2019: unresolved external symbol __imp__cairo_create
>> error LNK2019: unresolved external symbol __imp__cairo_destroy
>> etc.
>>
>
> According to 'src/cairo.h' you need to define CAIRO_WIN32_STATIC_BUILD
> if you've built cairo statically. However, it looks like you'll need
> to define that for any library which links to cairo (i.e. rather than
> defining it when building cairo itself). Defining that preprocessor
> directive will ensure that 'cairo-public' is correctly defined for
> those libraries which link to cairo - BUT -
>
> What's interesting (admittedly from just a cursory glance) is that in
> 'src/cairoint.h', when building with MSVC, 'cairo_public' is defined
> as __declspec(dllexport). So when you build cairo statically it's
> probably just a happy accident if the library's symbols end up correct
> (i.e. the compiler was clever enough to realise that a static library
> can't have dllexported symbols).
>
> Try defining CAIRO_WIN32_STATIC_BUILD for any libraries where you're
> seeing those unresolved externals. You'll need to rebuild those libs
> but hopefully, the errors will go away.
>
> A silly question but.... why do you need cairo to be a static lib
> anyway?
>
> John
</pre>
<br>
</div>
<br>
</body>
</html>