[flac-dev] flac 1.3.0pre2 pre-release

Ben Allison benski at winamp.com
Mon Mar 11 06:04:00 PDT 2013


> On Mon, Mar 11, 2013 at 08:30:18AM -0400, Ben Allison wrote:
>> From 6.7.4.6
>> An inline definition does not provide an external definition for the
>> function, and does not forbid an external definition in another
>> translation unit. An inline definition provides an alternative to an
>> external definition, which a translator may use to implement any call to
>> the function in the same translation unit.
>
> My understanding is that it's not an "inline definition" as there is
> a non-inline declaration in bitreader.h.
>
> If there are no better solutions to fix the problem, I'd suggest to
> #define inline to nothing for MSVC.

Looking at the spec again, and using the information in Example 7, I found
that if we put the following AFTER the inline definition, it becomes
available to other translation units.

extern unsigned FLAC__bitreader_get_input_bits_unconsumed(const
FLAC__BitReader *br);

This appears to be different behavior than other uses of the keyword
'extern' (just like the multiple uses of the keyword 'static').  6.7.4.7
of the C99 spec suggests that a statement such as the above turns an
inline definition into an external definition.

Add 'extern' to the .h file is unsafe, as any file that included
bitreader.h and chose to define an alternate inline definition (as allowed
by the spec) would also end up defining an external definition and would
result in duplicate symbols.

I will redo the patch with these 'extern' function definitions defined
inside the corresponding .c files.

Hope that helps.

-Ben Allison


More information about the flac-dev mailing list