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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How to use GNAT.Serial_Communications ? Date: Sat, 14 Sep 2013 06:42:30 +0100 Organization: A noiseless patient Spider Message-ID: References: <05ecdd0e-41cf-4961-88db-22e0a8cba3f6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="9fea184f47d12c052eb0a8a21bb4972e"; logging-data="29213"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QdeLXbuCl+oHzOF1JgkkAFQr1QqfW3hc=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:yyuM+Z84YVo7ZRLFOFLtiEej81c= sha1:Ym/PhWBk1l4n3qHZhjzc1JHWvoA= Xref: number.nntp.dca.giganews.com comp.lang.ada:183356 Date: 2013-09-14T06:42:30+01:00 List-Id: elbric0 writes: > with GNAT.Serial_Communications; use GNAT.Serial_Communications; > > procedure Test_Serial is > > Serial : Serial_Port; Serial : aliased Serial_Port; > C : Character; > > begin > > Open (Port => Serial, Name => Name (1)); > > C := 'A'; > > Character'Write (Serial, C); Character'Write (Serial'Access, C); > Close (Serial); > > end Test_Serial; > ---------------------------------------------------------------- > > However the type of the first parameter of Character'Write is not > correct. I get this error message: "expected access to > Ada.Streams.Root_Stream_Type'Class". > > Can someone tell me what I should put there instead of Serial? ... as above; in GNAT.Serial_Communications, type Serial_Port is new Ada.Streams.Root_Stream_Type with private; and, as the error message said, you need an access to one of those. Serial has to be declared aliased so that 'Access can be taken (otherwise, who knows, it might be kept in a register). > Do you know any tutorial or code example that can help me? Sorry, someone else may.