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.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, STOX_REPLY_TYPE autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3bb692a2b3589bc3 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe09.iad.POSTED!92f42029!not-for-mail From: "Steve D" Newsgroups: comp.lang.ada References: <1e5e4fd4-5de0-46e6-8c58-d2c7a6fb222a@k6g2000yqn.googlegroups.com> <61b5f53d-51f5-4f8e-8586-b176a75bb139@c14g2000yqm.googlegroups.com> In-Reply-To: <61b5f53d-51f5-4f8e-8586-b176a75bb139@c14g2000yqm.googlegroups.com> Subject: Re: COM problem MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Thu, 27 Aug 2009 03:57:39 UTC Organization: TeraNews.com Date: Wed, 26 Aug 2009 20:57:28 -0700 Xref: g2news2.google.com comp.lang.ada:8010 Date: 2009-08-26T20:57:28-07:00 List-Id: "Chrono" wrote in message news:61b5f53d-51f5-4f8e-8586-b176a75bb139@c14g2000yqm.googlegroups.com... > On 25 ago, 22:50, "Steve D" wrote: >> "Pablo" wrote in message >> >> news:1e5e4fd4-5de0-46e6-8c58-d2c7a6fb222a@k6g2000yqn.googlegroups.com... >> >> >I have a field type Field_Type whose record values I have to set into >> > a variant variable. How do I do this? >> >> If you're using GNATCOM (for example): >> >> float_value : float := 42.0; >> variant_value : GNATCOM.Types.VARIANT; >> ... >> value := GNATCOM.VARIANT.To_VARIANT( float_value ); >> >> You can find GNATCOM at:http://sourceforge.net/projects/gnavi/files/ >> >> Regards, >> Steve > > You understood what I meant... but my problem is that my variable is a > record. Say us, I have a Field_Type defined as a record like > type Field_Type is > record > Truth : GNATCOM.Types.VARIANT_BOOL; > Determination : Interfaces.C.double; > end record; > so in my code I set the values like > Field : Field_Type := (Truth => 1, Determination => 5.323423423); > > Then I have to convert this Field_Type Field into a Variant type > My_Variant : aliased GNATCOM.Types.VARIANT; *** > > Due to I have to execute a method > Method (Parameter_Doesnotmatter, My_Variant'access); > > *** So this is the problem... would you please help me? Thanks so much. You probably need to create a local of type GNATCOM.TYPES.VARIANT ... .something along the lines: My_Variant : aliased GNATCOM.Types.VARIANT; ... My_Variant := GNATCOM.VARIANT.To_VARIANT( Field.Truth ); Method( Parameter_Doesnotmatter, My_Variant'access ); Unfortunately I haven't used Ada much in the last couple of years, and I don't have a compiler handy to verify this, but this is where I would start. Regards, Steve