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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,72a0bc6240d264e3 X-Google-Attributes: gid103376,public From: "NANCY HEHIR" Subject: Re: Access and alias Date: 2000/04/04 Message-ID: #1/1 X-Deja-AN: 606695896 References: <86d7o5ae23.fsf@ppp-169-201.villette.club-internet.fr> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: abuse@eircom.net X-Trace: news.indigo.ie 954875483 159.134.245.180 (Tue, 04 Apr 2000 20:11:23 BST) Organization: Information Age Town NNTP-Posting-Date: Tue, 04 Apr 2000 20:11:23 BST Newsgroups: comp.lang.ada Date: 2000-04-04T00:00:00+00:00 List-Id: I am trying to use SetCommState to configure a Comm Port. I have created a handle for COM1 using CreateFile. SetCommState takes as it's parameters the handle and a type LPDCB (access to the DCB) The type LPDCB is defined in Win32-winbase.ads Thanks for your help Laurent Guerby wrote in message <86d7o5ae23.fsf@ppp-169-201.villette.club-internet.fr>... > >Try: > > DCB_1 : aliased DCB; > >> . >> . >> DCB_Access:LPDCB := DCB'Access; >> >> compiler generates error 'prefix of "Access" attribute must be aliased' > >However, it is very "rare" in Ada to use aliased variables, if you're >from a C background and try to write Ada like you write C I think >adding "aliased" and "'access" everywhere is not the right thing to >do. A possible guess is that you are emulating the use of "&" in C >with aliased/access, and that the right way to do it in Ada is to use >the "in out" parameter mode. > >May be if you tell us more about what you're trying to do, we can >suggest appropriate Ada idioms (note that may be the use of aliased >and access is the appropriate idiom here ;-). > >--LG