comp.lang.ada
 help / color / mirror / Atom feed
* Re: File descriptor interfacing
  1998-05-05  0:00 File descriptor interfacing Richard Beare
@ 1998-05-05  0:00 ` Geert Bosch
  1998-05-05  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Bosch @ 1998-05-05  0:00 UTC (permalink / raw)



Richard Beare <Richard.Beare@cmis.csiro.au> wrote:
   The file control block is a private time, so I guess I should
   be using unchecked conversion. Is this the only way?

If you think the file control block is just a private type to
make your life harder, you can use unchecked conversion. 
But then, you could as well change the relevant run-time source to
make the type non-private.

In the case that you think the type was made private on purpose
to prevent you from depending on GNAT internals that can change
without notice then just use the provided interface in the package
spec. BTW, note that you never should use packages in the system
hierarchy that are not described in the Ada RM or the GNAT RM!

Regards,
   Geert




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: File descriptor interfacing
  1998-05-05  0:00 File descriptor interfacing Richard Beare
  1998-05-05  0:00 ` Geert Bosch
@ 1998-05-05  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1998-05-05  0:00 UTC (permalink / raw)



Richard Beare asks

<<The gnat os_lib package is one option, but that means the library user
would have to start using file descriptors as well. I think it would be
better if the user could pass a "file_type" from which the c file
descriptor could be extracted.
>>

Functions to extract file descriptors from Ada files are standardly 
available in GNAT, as are functions to open files givenm C file descriptors.
How do you find out about all this? You consult the ultra-secret source
of information, namely the GNAT documentation that comes with GNAT :-)
Have a look at the sceion in the manual hidden under the obscure 
title "Interfacing to C Streams"






^ permalink raw reply	[flat|nested] 3+ messages in thread

* File descriptor interfacing
@ 1998-05-05  0:00 Richard Beare
  1998-05-05  0:00 ` Geert Bosch
  1998-05-05  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Beare @ 1998-05-05  0:00 UTC (permalink / raw)



I am producing some bindings to image libraries, like libtiff. Some of
the functions in these libraries take file descriptors as arguments. I
definitely want to retain functions operating at this level (file_type
rather than file names), but I am not sure about the most appropriate
way to interface.

The gnat os_lib package is one option, but that means the library user
would have to start using file descriptors as well. I think it would be
better if the user could pass a "file_type" from which the c file
descriptor could be extracted.

This information is in the system.file_control_block package, but I am
unsure about the best way of extracting the "stream" information. The
file control block is a private time, so I guess I should be using
unchecked conversion. Is this the only way?

-- 
Richard Beare
Richard.Beare@cmis.csiro.au




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-05-05  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-05  0:00 File descriptor interfacing Richard Beare
1998-05-05  0:00 ` Geert Bosch
1998-05-05  0:00 ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox