[cairo] "export" annotations on public APIs

Bob Jamison rjamison at titan.com
Tue May 10 13:23:17 PDT 2005


Carl Worth wrote:

>On Thu, 21 Apr 2005 15:59:12 +1200, Robert O'Callahan wrote:
>  
>
>>Integrating Cairo into Mozilla, we've run into a problem building Cairo as a 
>>shared library --- there are no annotations to indicate which functions 
>>should be exported from a shared library, when building on a platform that 
>>doesn't export all symbols by default.
>>    
>>
>
>We have gone through the complementary effort and annotated each
>function that should not be exported with "cairo_private", (though we
>might not have 100% of the functions tagged at the moment). Could
>those annotations be adequate for your use?
>
>  
>
>>                                       This affects not only Win32, but now 
>>also gcc4 when we use "#pragma GCC visibility" to hide internal symbols. 
>>Would a patch that adds a CAIRO_EXPORT macro to all public functions (by 
>>default, defined to nothing) be looked upon favourably?
>>    
>>
>
>One thing I really like about annotating the non-exported functions is
>that the public header file does not get cluttered and, as such,
>maintains quite good readability. I'd like to preserve that if we can.
>
>If annotations in the public header do prove unavoidable I might
>suggest "cairo_public" as an annotation to maintain consistency with
>our current cairo_private annotation. (But again, I'd prefer to only
>have to mark the private functions).
>
>-Carl
>  
>
Since on Unix-like boxen, public symbols are by default all exported, do you
mean on Win32?  If so, then I would hope that the evil 
"__declspec(dllimport)"
-not- be inserted into any of the Cairo source files.  Please make the 
substitution
at a higher level, or export them in the much nicer and cleaner .def 
files.  Very
often that declaration can break a build, or lock someone into using a 
DLL when
it is not wanted.



Bob Jamison
Titan Corp




More information about the cairo mailing list