comp.lang.ada
 help / color / mirror / Atom feed
* Unchecked_Conversion help needed
@ 2004-12-21 21:22 rcarnesiii
  2004-12-21 21:49 ` rcarnesiii
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: rcarnesiii @ 2004-12-21 21:22 UTC (permalink / raw)


I used Ada many years ago and am now getting back into it. Here's my
problem, I have to applications and am sending messages between them.

Sending procedures function call
Send_Message
     (Partner => The_Handle,
      Message => Message(X)'Address,
      Bytes   => Message(X).Length,
      Message_Id => My_Message_Id);

On the receiving side my callback routine looks like this

Process_Message_From_Partner
            (Partner : Xxx.The_Handle;
             Message : in System.Address;
             Bytes   : in Positive;
             Message_Id : in Xxx.Message_Id) is

begin
  my code

end Process_Message_From_Partner;

What I would like to do is print out the message on the receiving side.

Is this possible using unchecked_conversion ?

Thanks


 




^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: Unchecked_Conversion help needed
@ 2004-12-22  3:29 Nick Roberts
  2004-12-22  8:03 ` Jerome Hugues
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2004-12-22  3:29 UTC (permalink / raw)


"rcarnesiii" <reid_carnes@yahoo.com> wrote:

> I meant I have two apps talking to each other.

This is a problem that may be addressed (pardon the pun) by Annex E of the
Ada 95 Reference Manual (RM95). I believe there is an Open Source
implementation, but I forget the name. Alternatively, some Object Request
Broker (ORB) system might be what you need.

In any case, the essence of communication between two Ada programs (or
partitions) usually involves using streams and serialisation -- see RM95
section 13.13 -- to perform what is called 'marshalling' of data.

Values of a type T are serialised and deserialised by the T'Write and T'Read
procedures or the T'Output procedure and T'Input function, as described in
the RM95.

To transfer a set of values from one program to another, the source program
marshalls (serialises) the values into a stream (using T'Write or T'Output),
then the stream is transferred from the source program to the target program
(how this is done depends on a lot of things), then the values are
unmarshalled (deserialised) into variables (using T'Read or T'Input) in the
target program.

A stream which represents a shared file or shared memory area may be used to
effect the transfer of data. In the case of programs which are running on
different machines, a stream which represents a (buffered) network channel
between the machines may be used.

For some types (typically limited and access types), you will need to write
your own serialisation code (you then use a 'use' clause to declare them as
the implementations of T'Write and T'Read and/or T'Output and T'Input).

Please reply if you need more help.

-- 
Nick Roberts



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

end of thread, other threads:[~2004-12-23  0:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-21 21:22 Unchecked_Conversion help needed rcarnesiii
2004-12-21 21:49 ` rcarnesiii
2004-12-21 21:53 ` tmoran
2004-12-22  0:17   ` Jeffrey Carter
2004-12-22  5:41     ` Brian May
2004-12-23  0:32       ` Jeffrey Carter
2004-12-22  9:21 ` Adrien Plisson
  -- strict thread matches above, loose matches on Subject: below --
2004-12-22  3:29 Nick Roberts
2004-12-22  8:03 ` Jerome Hugues
2004-12-22  9:24   ` Pascal Obry
2004-12-22  9:55   ` Martin Krischik
2004-12-22 12:46     ` Pascal Obry
2004-12-22 14:14       ` Jerome Hugues
2004-12-22 14:30         ` Pascal Obry
2004-12-22 14:09     ` Jerome Hugues
2004-12-22 18:33       ` Martin Krischik

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