[matroska-devel] changing #includes ?

Moritz Bunkus moritz at bunkus.org
Sat Jun 28 18:49:12 CEST 2003


Heya again,

one thing that sam (vlc developer) asked me and that I couldn't really
answer was:

Why do we include all files directly?

Meaning we have to '#include <KaxTags.h>' and don't '#include
<matroska/KaxTags.h>'. My guess is that on Windows it's simply done this
way, but for Unix/Linux and all Unix-alike systems this is very
unnatural as you always have to specify the include paths for those two
directories:

g++ -I/usr/include/ebml -I/usr/include/matroska ...

This makes it harder to detect if libebml and libmatroska are installed
on a system.

Now why do I put them into such subdirectories in the first place? Two
simple reasons:
1. We have so many include files that would clutter
/usr/include. Keeping them in one subdir helps finding the right include
file a lot.
2. There's an 'api' subdir for both libebml and libmatroska. This name
is so fucking general that I'd never want it to be directly in
/usr/include. "/usr/include/api" - what the hell is "api" for? (I know
what it is for, but it's really ugly.)

We could change that. It would involve some work, but not too
much. Steps necessary to change it:

1. Change the CVS structure for both libebml and libmatroska. Rename
   'src' to 'ebml' and 'matroska' would be enough, but this would have
   to be done on the cc.org server itself as CVS sucks badly when it
   comes to renaming files/directories.
2. Change the Makefiles (easy).
3. Change all #include statements in all files in the CVS and the user
   programs. This is where some work is involved, but again not overly
   much. I can automatically change all files in the CVS, and you other
   guys could simply replace "#include <Kax" with "#include
   <matroska/Kax" and "#include <Ebml" with "#include <ebml/Ebml". There
   are some few more files, e.g. IOCallback.h and the likes.

This would best be accompanied by a new release, e.g. 0.5.0 to make it
clear that the "API" has changed.

For the Windows guys this will look rather unnatural, I guess, but it's
not a big problem for you either. Instead of adding
"c:\whatever\libmatroska\src" as an include directory to your MSVC
project you add "c:\whatever\libmatroska\matroska". No big deal. But for
the Unix-like world with autoconf based or self-made-scripts based
detection for those two libs this change would be really, really
improving standards compliance and generally ease the usage of libebml
and libmatroska.

Please at least consider this. Thanks.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)
http://www.matroska.org



More information about the Matroska-devel mailing list