[Mesa-dev] extern "C" sometimes in header files but not always..
Emil Velikov
emil.l.velikov at gmail.com
Mon Mar 31 07:15:25 PDT 2014
On 31/03/14 11:55, 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?
>
I'm not entirely sure if there is a rule to be honest. I would suspect that
people update the headers as needed, based on the fact that originally mesa
did not have any/was not linked against c++ code.
IMHO if would be great if we have those guards at least in the headers we
distribute during install, although I've not checked if that is the case.
-Emil
P.S. Take the above statements with a pinch of salt.
> -Kevin
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list