[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] enclosing FreeType in a C++ namespace
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] enclosing FreeType in a C++ namespace |
Date: |
Thu, 09 Jul 2015 15:19:31 +0200 (CEST) |
Hello Graham!
> 3. Make FT_BEGIN_HEADER and FT_END_HEADER into the start and end of
> the namespace:
>
> #define FT_BEGIN_HEADER namespace CartoType {
> #define FT_END_HEADER } // namespace CartoType
>
> For this to work, I had to remove FT_BEGIN_HEADER and FT_END_HEADER
> from pshalgo.h, because it #includes other headers; while 'extern
> "C"' can be nested, a nested namespace is a different namespace.
Are you really meaning `pshalgo.h'? In this file there isn't an
#include statement after FT_BEGIN_HEADER... Anyways, this should be
easier now with my latest commit: I've moved around
FT_{BEGIN,END}_HEADER to not #include header files that contain
FT_{BEGIN,END}_HEADER files by themselves.
> 4. Put all indirectly compiled .c files into the namespace. These
> are the source files which were not renamed to .cpp files, and are
> #included by them. They are compiled as C++ because they become part
> of the same compilation unit when #included. For example, the file
> ttdriver.c acquires 'namespace CartoType {' after all its #include
> statements, and '} // namespace CartoType' at the end of the file. I
> had to do that to about 40 files.
I guess this is too special to get upstream support ...
> [...] I am aware that C and C++ are not entirely compatible, but
> this has not caused any difficulties, apart from trivial matters
> like casting the return value of malloc from void* to the desired
> pointer type in a couple of places, [...]
In FreeType? Theoretically, this shouldn't be necessary.
Werner