Ilya Zakharevich on Tue, 13 Mar 2001 15:03:20 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PATCH] OS/2 dynalinking


On Tue, Mar 13, 2001 at 08:25:49PM +0100, Karim.Belabas wrote:
> Would a directory src/systems, containing e.g.
> 
>   os2.c     unix.c   winCE.c
>   os2.h     unix.h   winCE.h
> 
> each system being represented by only 2 files, be acceptable ? We could then
> eventually remove all instances of 1).  The unix.c file would contain most of
> the current conditional code, e.g wrappers for all system calls we use (the
> current 2)). Files for "alien" systems return failure codes for most of them,
> and implement some others. Ideally, most system-oriented of feature-oriented
> #ifdef would disappear from the general code and be concentrated in that
> directory.

So instead of

#include <dlfcn.h>

one will need to 

#if PARI_ARCH == PARI_ARCH_UNIX
# include "pari_unix.h"
etc...

in the "private" files linked with PARI?  The alternative is for one
PARI header file to include the whole universe - leading to possible
conflicts of #defines.  Well, Perl survives this without a lot of
problems...

Note that the prefix "pari_" for header files is necessary to avoid
another kind of conflicts...

> This would make clearer the actual dependance on various OS features in the
> PARI code [e.g it is not normal that current src/modules/galois.c contains an
> #ifdef UNIX !!!]. And might initiate implementations of obviously missing
> features :-). But I think it would be too much of a hassle to link in many
> additional small code modules for each system (as your proposed naming scheme
> implies), hence the "bulk" approach. Does this look OK ?

Again, in Perl there are "bulk" os2.c/os2ish.h files, and there are
separate dl_os2.c and dlfcn.h (which I reaped from there).  ;-)  It
should not be a problem to merge dl_os2.c into os2.c, but dlfcn.h
looks like a finer topic.

Do not have a clear opinion,
Ilya