[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[swarm-hackers] header directory structure
From: |
Scott Christley |
Subject: |
[swarm-hackers] header directory structure |
Date: |
Sun, 06 Jul 2008 14:34:31 -0700 |
Hello,
I recently committed some changes, albeit to the objc runtime branch,
that changed how header files are referenced from other header files.
For example this:
#import <defobj/DefObject.h>
got changed to this:
#import "DefObject.h"
The reason is due to how frameworks are constructed on Apple (and
GNUstep). For those not familiar, frameworks are a simple directory
wrapper structure that puts a dynamic library, its header files,
documentation, any resource files. Normally on UNIX-like systems,
these are separated in difference directories, e.g. the library goes
in /usr/local/lib, the header files go in /usr/local/include, the
documentation goes in another place as well as the resource files.
The nice thing about frameworks is because everything is wrapped up
together, it is easy to copy, distribute, move, etc., the framework
around and it always has everything together.
However, the design of the framework is fairly rigid, it has a single
header directory that *all* headers go into, and it doesn't allow
having subdirectories. When programs use a framework, they always
reference the framework name as part of #import statement, so for
example if my framework was SwarmOSX, then swarm applications would do
this:
#import <SwarmOSX/DefObject.h>
So the existing Swarm header files don't work once they get put into
the framework, it doesn't know anything about a "defobj"
subdirectory. Once possible solution is to use cpp defines to do the
appropriate #import like this:
#if OPENSTEP
#import <Swarm/DefObject.h>
#else
#import <defobj/DefObject.h>
#endif
but personally I think this is pretty ugly and it will need to be done
throughout all the header files.
What I would like to suggest is that the UNIX and OpenStep headers are
standardized together and that all headers get put into a single Swarm
header directory. So instead of this:
#import <defobj/DefObject.h>
it will be:
#import <Swarm/DefObject.h>
for all header files regardless of which Swarm module. Besides
keeping a certain degree of source compatibility between Apple,
GNUstep, and GNU/Linux systems, another reason (though I have to admit
it is pretty weak) is that putting header files in the main include
directory, like Swarm does with activity.h, space.h, etc., has the
potential to conflict (filename) with other software. By putting
everything in a Swarm subdirectory, we are safer with only the "Swarm"
name as a potential conflict.
The downside is that when the objc runtime work gets put into the main
branch, it will break existing source code. It's not a major change,
but does require everybody to change all their #import statements.
what do people think?
Scott
- [swarm-hackers] header directory structure,
Scott Christley <=
- Re: [swarm-hackers] header directory structure, Marcus G. Daniels, 2008/07/06
- Re: [swarm-hackers] header directory structure, Bill Northcott, 2008/07/06
- Re: [swarm-hackers] header directory structure, Scott Christley, 2008/07/06
- Re: [swarm-hackers] header directory structure, Bill Northcott, 2008/07/07
- Re: [swarm-hackers] header directory structure, Marcus G. Daniels, 2008/07/07
- Re: [swarm-hackers] header directory structure, Scott Christley, 2008/07/07
- Re: [swarm-hackers] header directory structure, Bill Northcott, 2008/07/07
- Re: [swarm-hackers] header directory structure, Scott Christley, 2008/07/07
- Re: [swarm-hackers] header directory structure, Marcus G. Daniels, 2008/07/07