pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Public API and gl_list


From: gerel
Subject: Re: [pdf-devel] Public API and gl_list
Date: Thu, 13 Mar 2008 15:08:12 -0300

I've really tried to write a correct pdf-list.h with inlined functions in order
to be exported to the global API, be included by other modules, and be usable by
an external client. But I couldn't succeed.
There are few reasons for which I'd suggest to create a separate file for the
inline version.

These are the points where I got stuck and then tried to solve until I got to
a messy stage and completely gave up.

1. Since each inline function is going to be defined in the header file
   pdf-list.h and we need to include gl_array_list.h we can't use the inline
   definitions for the global API.

2. Since we need each declaration to be 'extern' to be exported to pdf.h and at
   the same time we need to declare them 'static' because otherwise the compiler
   will fail arguing that there are multiple definitions for the same global
   symbol when we try to compile upper layer modules that need pdf-list.h.
   We'll have an 'extern' declaration followed by a 'static' inline definiton.
   This the compiler will not accept.

3. Even if we manage to solve the above problem when we try to compile 
pdf-list.c
   the compiler again will fail arguing that previous definitons for the 
functions
   were done in pdf-list.h (the inline ones).

4.a If we simple remove each function definition in pdf-list.c solving the above
    problem then an external client won't have access to any pdf_list_* function
    since we previously declared each function as 'static inline' and no code is
    generated for the function on its own. (there's a flag to solve this
    "-fkeep-inline-functions" but I don't trust this solution).

4.b If we choose to not include pdf-list.h in pdf-list.c and copy-paste the
    structure declarations from pdf-list.h directly in pdf-list.c, it _may_
    work but the solution is totally counter-intuitive and ugly.

I'm a bit tired of this issue and it's so much trouble that I have no plans to
lead with it any further.

My idea would be to create a pdf-list-inline.h for internal use by gnupdf and
leave pdf-list.[ch] for external clients along with the global API.

If you find a working solution for this, please send the patches, I'll be very
thankful, really.

I'm not planing to spend more time on this issue. I'll continue with the unit
tests for the module.

My apologizes.

-gerel






reply via email to

[Prev in Thread] Current Thread [Next in Thread]