Fwd: Re: Cairo win32 Static linking

WC Black <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Forwarding this so it appears properly in archives.

-------- Original Message --------
Subject: 	Re: [cairo] Cairo win32 Static linking
Date: 	Sun, 02 Feb 2014 07:11:38 -0500
From: 	WC Black <[email protected]>
To: 	John Emmas <[email protected]>



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

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.