New to OSLib
John Tytgat
John.Tytgat at aaug.net
Sat Oct 27 14:00:01 BST 2007
In message <8bae55384f.admin at snowstone.org.uk>
Adam <lists at snowstone.org.uk> wrote:
> The os_error type clashes with the DeskLib definiton. Is there an
> established way to resolve this?
Wildly guessing I think this used to work when oslib/os.h got included
before DeskLib's Core.h as currently:
DeskLib's Core.h:
--8<--
/* Operating system errors (== _kernel_oserror).
* Conditional compilation to avoid clashes with EasyC's roslib and
* Acorn's "os.h".
*/
#ifndef __roslib_h
#ifndef __os_h
typedef struct
{
int errnum;
char errmess[252];
} os_error;
#endif
#endif
--8<--
The reason why this doesn't work today that, I believe, OSLib's multiple
include protection __os_h got changed into os_H (the underscore starting
#defines are not to be used by user headers).
So you could change DeskLib Core.h test __os_h -> os_H and make sure that
in code using DeskLib and OSLib you're including OSLib's oslib/os.h
before DeskLib's Core.h (well assuming that 'Acorn's "os.h"' is refering
to OSLib or an early version).
Maybe we should consider doing the same in OSLib, i.e. checking on
DeskLib's Core.h multiple include protection (which is currently
__dl_core_h). Although I have a feeling that this is only the start of
incompatibilities between those two library headers as both define
TRUE, FALSE, ERROR, NULL etc and probably this first need to go through
the bottom of this excercise and come up with a proposal for such changes.
You feel up doing that Adam ?
BTW, when you're using a C compiler and settings that allows support for
namespaces, you can set NAMESPACE_OSLIB in OSLib. I don't think this is an
option for Norcroft compiler (can someone confirm this ?), but it is one for
GCC. On the other hand, this requires a recompilation of OSLib binary
library so I don't think this is a OSLib user friendly solution.
John.
--
John Tytgat, in his comfy chair at home BASS
John.Tytgat at aaug.net ARM powered, RISC OS driven
More information about the oslib-user
mailing list