From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,17f2366fc6172420 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!w17g2000yqh.googlegroups.com!not-for-mail From: kug1977 Newsgroups: comp.lang.ada Subject: Re: Access Type Date: Tue, 28 Dec 2010 12:08:26 -0800 (PST) Organization: http://groups.google.com Message-ID: <76b6b4aa-201c-412d-93de-d22b532fde3f@w17g2000yqh.googlegroups.com> References: <8d8e1094-d021-4456-85fb-bbb2f3911334@m7g2000vbn.googlegroups.com> <3af2d3d1-ede9-4255-a31b-c5f66c6cee2e@c2g2000yqc.googlegroups.com> <87hbe0m1be.fsf@ludovic-brenta.org> <878vzbm7ah.fsf@ludovic-brenta.org> <4D18F124.1050005@obry.net> NNTP-Posting-Host: 92.228.17.186 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1293566906 26155 127.0.0.1 (28 Dec 2010 20:08:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Dec 2010 20:08:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w17g2000yqh.googlegroups.com; posting-host=92.228.17.186; posting-account=3ciIaAoAAAA6pCfildcdAcuc3UQuirtL User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:16207 Date: 2010-12-28T12:08:26-08:00 List-Id: Hi, after solving the first problem with access, I'm running into the next one. SORRY, I'm a beginner in Ada and stupid question pave my way of learning. For my programm I need a type like System.Address but with a definitive size of 32-bits. So I've create one type t_OFW_vAddress is mod t_Cell_Size; for t_OFW_vAddress'Size use 32 ; pragma Assert (t_OFW_vAddress'Size = 32); pragma Assert (t_OFW_vAddress'Alignment = 4) ; OFW_Null_vAddress : constant t_OFW_vAddress := 0; I've now a record I will pass to a C-like function looks like this: type Chain_CI_Args is record ... Another_Clients_Entry : t_OFW_vAddress := OFW_Null_vAddress; Another_Clients_Arguments : t_OFW_vAddress := OFW_Null_vAddress; ... end record; pragma Convention (C, Chain_CI_Args); 'Another_Clients_Entry' will hold the address of a procedure I defined by this: type Client_Entry is access procedure; pragma Convention (C, Client_Entry); and 'Another_Clients_Arguments' will be an array type t_OFW_Buffer is array (Positive range <>) of t_OFW_Byte; In my procedure I fill this record by procedure Chain (Virtual_Address : in t_OFW_vAddress; Free_Number_Of_Bytes : in Cell; Another_Clients_Entry : in Client_Entry; Another_Clients_Arguments : in t_OFW_Buffer) is Arg : Chain_CI_Args := (... Another_Clients_Entry => t_OFW_vAddress'(Another_Clients_Entry), -- ??? Another_Clients_Arguments => Another_Clients_Arguments (Another_Clients_Arguments'First)'Address, -- ?? ... ); ... I'm sure you'll see by first looking, that this doesn't work. Maybe some conversion is needed, but I don't know how. King regards, kug1977 PS: I know, that this isn't something a beginner in Ada should start with, but I like to finnish porting this from C to Ada.