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,32a8d58bcd92b75c X-Google-Attributes: gid103376,public From: John Walker Subject: Re: Win32: Using COM from Gnat Date: 1999/02/10 Message-ID: #1/1 X-Deja-AN: 442775808 X-NNTP-Posting-Host: jswalker.demon.co.uk:158.152.57.197 References: <36b1c4dc.19475234@news.origin-it.com> X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 918648896 nnrp-02:7486 NO-IDENT jswalker.demon.co.uk:158.152.57.197 Organization: JSW Technology MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-10T00:00:00+00:00 List-Id: In article <36b1c4dc.19475234@news.origin-it.com>, Paul Moore writes >Hi, >I'm looking at Ada as a possible alternative language for programming >under Win32. One important area for me would be interfacing to COM >components. Can anybody tell me if there is a *simple* way of getting >at a COM object's interfaces from Gnat? For example, suppose I have a >COM object which implements IStream. I'd like to be able to call the >Read method using something straightforward like > > COM_Object.Read(buffer, size, num_read) > >and NOT something visually impossible to read like > > COM_Object.vtbl.ptr_Read(buffer'unchecked_access, size, > access ptr num_read) > >(As you can see, I don't know Ada syntax yet!) Basically, I'd like >something which hides the implementation details, like C++ COM code >does, rather than something that exposes the internals, like C COM >code. > >I saw a pointer to something on this subject in this newsgroup >recently, but it looked a bit like the second example (pages of code >to create and access an instance of a trivial "beep the speaker" >object). Frankly, too much of Win32's internals are now COM-based for >verbose, unreadable code to be usable... > >[BTW, don't construe this as a flame against Gnat, or Ada. I have no >axe to grind here - it's just that I'm looking for an alternative to >C++ for Win32 programming, without losing the advantages of C++ as >regards COM programming...] > >Thanks in advance, >Paul Moore. > The latest version of my bindings for Win32 are derived from the C++ "flavour" of Win32 rather than the C flavour such that COM interfaces are mapped from C++ classes. Have a look at www.jswalker.demon.co.uk/js wtech.htm and specifically the WinAPI upgrade for DSound which includes a trivial example for using the COM interface. I hope this doesn't turn out to be the "beep the speaker" example you refer to! My bindings are distributed with Aonix ObjectAda but the example shows you what can be done. -- John Walker Email: john@jswalker.demon.co.uk Web : http://www.jswalker.demon.co.uk/ Tel : +44 (0) 118 9403749