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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.89.15 with SMTP id b15mr9583948yhf.13.1392653590066; Mon, 17 Feb 2014 08:13:10 -0800 (PST) X-Received: by 10.50.221.99 with SMTP id qd3mr333829igc.6.1392653589853; Mon, 17 Feb 2014 08:13:09 -0800 (PST) Path: backlog2.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!f11no22217526qae.1!news-out.google.com!h8ni16igy.0!nntp.google.com!c10no26675683igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 17 Feb 2014 08:13:09 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <050a1b45-c312-4fff-96f9-7c3d01466500@googlegroups.com> Subject: Re: Pass a serial port as user data in a GTK callback handler? From: adambeneschan@gmail.com Injection-Date: Mon, 17 Feb 2014 16:13:09 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:184938 Date: 2014-02-17T08:13:09-08:00 List-Id: On Saturday, February 15, 2014 3:32:58 PM UTC-8, hreba wrote: > Hi, >=20 > I am new to Ada and still overwhelmed by the complexity of the language. >=20 > My actual programming exercise has a GTK GUI, and I want a callback=20 > handler to communicate through a serial port, so I need to pass the port= =20 > in my user data, which must be of >=20 > type User_Type (<>) is private; >=20 > which means it must be nonlimited. >=20 > But GNAT.Serial_Communications.Serial_Port is limited: >=20 > type Serial_Port is new Ada.Streams.Root_Stream_Type with private; > type Root_Stream_Type is abstract tagged limited private; >=20 > I tried to pass a reference to the port, and it must be an "access all"= =20 > (because it is not allocated by my, but a preexisting variable (hardware= =20 > resource), as I understand it): >=20 > port: access all GNAT.Serial_Communications.Serial_Port; >=20 > But then I get an error message >=20 > "all" is not permitted for anonymous access types. >=20 > Is there a solution? I agree with everyone else that anonymous access types aren't needed in thi= s case, and you're better off using a named access type or something else. = Having said that, I just wanted to point out something about Ada: all anon= ymous access types are automatically "access all", i.e. they can refer to a= liased variables. So you could have solved the problem by just removing th= e "all" keyword. -- Adam