[cairo] cairo compiles on win32 (cygwin)

Richard Worth richard at theworths.org
Fri Jan 23 05:40:16 PST 2004

Evan Martin wrote:

>On Fri, Jan 23, 2004 at 01:11:52AM -0500, Richard Worth wrote:
>>Two main fixes
>>1) I removed the 'extern ' and ' __external_linkage' (guarded 
>>win32/cygwin macro which added __declspec(dllexport) or 
>>__declspec(dllimport)) from function declarations in cairo.h and 
>>pixman.h. From what I can tell, these used to be necessary for building 
>>shared libraries for win32, but are no longer.
>I'm hardly a win32 expert, but the last time I tried building a library
>for win32 I found you either needed a .def file at link time, or some
>magic flags like dllexport, for your dlls to have any public functions.
>Perhaps it's only unnecessary with cygwin / mingw?
That may be right. I guess I could've been a little more clear. I 
removed the code for two reasons:
1) It did not seem to be implemented correctly. Every example code and 
piece of documentation that I could find on the subject had the 
__declspec(dllexport) at the beginning of the fuction declaration, 
before the type. Ex:

    __external_linkage void
    foo (int bar);

The implementations I pulled out looked like this:

    extern void __external_linkage
    foo (int bar);

In trying to get it to compile I tried many different things and in the 
end took it out. Now it looks like this:

    foo (int bar);

2) As far as I could tell, while the code was win32 and even cygwin 
specifig (the macro was defined only #if defined(WIN32) || 
defined(__CYGWIN__)), the code was not added by someone trying to get 
cairo to compile under win32 or cygwin. This was code from the slim 
library. I couldn't find anything on the mailing list suggesting that 
anyone was able to compile cairo for win32 or cygwin without 
modifications (and that was my goal) so I felt ok taking it out.

If someone were to compile in some other win32 environment (not 
unreasonable) it may turn out that it is necessary. I would feel better 
about them adding it for that reason. Until then the code is a lot 
easier to read.


- Richard D. Worth
richard at theworths.org

More information about the cairo mailing list