[Mesa-dev] extern "C" sometimes in header files but not always..

Brian Paul brianp at vmware.com
Mon Mar 31 06:58:33 PDT 2014


On 03/31/2014 04:55 AM, Rogovin, Kevin wrote:
> Hi,
>
>   I was doing some experiments and had linking issues with C++ code and saw that some Mesa header files have extern "C" wrappers and others do not. For example running:
>
> $ find src/mesa/main -type f -name "*.h" -exec  grep  -H -E -o -c "extern \"C\"" {} \; | grep  :0 | wc -l
>
> gives a result of 109 files. However, some header files in mesa/main and other places do have the extern "C" { wrapper, such as mesa/main/mtypes.h.
>
> What is the rule, if any, of what files have the extern "C" protection so that the file is suitable for inclusion by C++ source files?

The headers with extern "C" are probably those that get included by the 
GLSL compiler code (which is in C++).  Otherwise, I think extern "C" 
gets added on an as-needed basis.

-Brian




More information about the mesa-dev mailing list