comp.lang.ada
 help / color / mirror / Atom feed
From: jsanchor@my-dejanews.com
Subject: System.Address_to_Access_Conversions
Date: 1998/07/13
Date: 1998-07-13T00:00:00+00:00	[thread overview]
Message-ID: <6odddl$k94$1@nnrp1.dejanews.com> (raw)

Hello Everyone:  In my program I have some system address and I have to move
data to it. I am using access types to do this. I don't want to use Unchecked
conversion. So I started looking at a new feature Ada95 has
System.Address_to_Access_Conversions. I have

type Dummy_Type is tagged private;
type Ptr_to_Data_Type is access all Dummy_Type'class;

private
  type Dummy_Type is tagged
      record
         checksum : Storage_Element;
      end record;

Dummy       : Dummy_Type;
Ptr_to_Data : Ptr_to_Data_Type;


I want Ptr_to_Data to point to some system address, say, 16#00E00000#
with unchecked conversion I could say,

function Convert_to_Pointer is new UNCHECKED_CONVERSION (
                                                  source => system.address,
                                                  target => Ptr_to_Data_Type);

Ptr_to_Data := Convert_to_Pointer(16#00E00000#);

I tried using System.Address_to_Access_Conversions,

package Convert_to_Pointer is new
         System.Address_to_Access_Conversions(system.address);

Data_Ptr : Convert_to_Pointer.Object_Pointer;

Data_Ptr := Convert_to_Pointer(16#00E00000#); --This is my problem!!
-- I need a type Ptr_to_Data_Type, NOT Convert_to_Pointer.Object_Pointer

I tried casting
Ptr_to_Data := Ptr_to_Data_Type(Data_Ptr); --It compiled..but when I ran it
SEGMENTATION FAULT ERROR showed up.
Can anybody suggest how do I get the correct access type to point to memory.

Thank you in advance.
Jay S.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




             reply	other threads:[~1998-07-13  0:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-13  0:00 jsanchor [this message]
1998-07-13  0:00 ` System.Address_to_Access_Conversions Stephen Leake
1998-07-14  0:00   ` System.Address_to_Access_Conversions jsanchor
1998-07-14  0:00 ` System.Address_to_Access_Conversions Pascal MALAISE
1998-07-14  0:00   ` System.Address_to_Access_Conversions jsanchor
1998-07-14  0:00     ` System.Address_to_Access_Conversions David C. Hoos, Sr.
1998-07-14  0:00       ` System.Address_to_Access_Conversions jsanchor
1998-07-14  0:00         ` System.Address_to_Access_Conversions David C. Hoos, Sr.
1998-07-14  0:00       ` System.Address_to_Access_Conversions nabbasi
1998-07-14  0:00         ` System.Address_to_Access_Conversions David C. Hoos, Sr.
1998-07-15  0:00           ` System.Address_to_Access_Conversions jsanchor
1998-07-15  0:00             ` System.Address_to_Access_Conversions David C. Hoos, Sr.
1998-07-14  0:00         ` System.Address_to_Access_Conversions Robert Dewar
1998-07-26  0:00         ` System.Address_to_Access_Conversions Matthew Heaney
1998-07-26  0:00           ` System.Address_to_Access_Conversions nababsi
1998-07-26  0:00             ` System.Address_to_Access_Conversions Robert Dewar
1998-07-26  0:00             ` System.Address_to_Access_Conversions Matthew Heaney
1998-07-26  0:00               ` System.Address_to_Access_Conversions Robert Dewar
1998-07-26  0:00                 ` System.Address_to_Access_Conversions nabbasi
1998-07-26  0:00             ` System.Address_to_Access_Conversions Charles Hixson
1998-07-26  0:00               ` System.Address_to_Access_Conversions Robert Dewar
1998-07-26  0:00             ` System.Address_to_Access_Conversions Charles Hixson
1998-07-14  0:00 ` System.Address_to_Access_Conversions Anonymous
  -- strict thread matches above, loose matches on Subject: below --
1998-07-15  0:00 System.Address_to_Access_Conversions Marin David Condic, 561.796.8997, M/S 731-96
1998-07-26  0:00 ` System.Address_to_Access_Conversions Matthew Heaney
1998-07-27  0:00 System.Address_to_Access_Conversions Marin David Condic, 561.796.8997, M/S 731-96
1998-07-28  0:00 ` System.Address_to_Access_Conversions Stephen Leake
replies disabled

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