Re: int filehandle? && small rootcint enhancement.

Masaharu Goto (gotom@hpyiddq.jpn.hp.com)
Fri, 04 Jul 1997 9:02:44 JST


Robert,

Concerned about fileno() and POSIX functions,

> Im working on interfacing root with some fortran libraries which works
> fine (after some hassle). My problem at the moment is how to get the LUN
> of a file opened in CINT to pass it to some fortran function.
> According to POSIX there's a fileno() on streams which returns the int
> filehandle (I hope that's what fortran calls LUN) but I couldn't find it
> in CINT.
> Is there any other possibility to get such a LUN for a file?

It is technically easy to add POSIX functions in CINT. The reason of not
doing so is portability. I sticked within ANSI standard to make it work
with any kind of C or C++ compilers. Broadening the coverage gives
convenient features, but at the cost of portability issues. It seems
that POSIX.1 is very popular too. I'll consider POSIX extenstion as
an option at installation.

For the time being, you can embed dictionary to the POSIX functions
using rootcint (in case of ROOT/CINT) or makecint (in case of CINT).

For example, you create posix.h as follows
/* posix.h */
#include <stdio.h>
int fileno(FILE *stream);

And use rootcint to create dictionary source code,

$ rootcint PosixDICT.cc -c posix.h

Then compile and link PosixDICT.cc with ROOT or as DLL. fileno() will
be registered into dictionary.

By the way,
I already have mountain of heavy enhancement plans. I'd like to add
POSIX extension too. But this one can be done by somebody else. The
main work is to create posix.h so that it contains large enough
functionality of POSIX standard and safe enough subset that works on
all computer platforms.

Masaharu Goto