comp.lang.ada
 help / color / mirror / Atom feed
* Win32: Using COM from Gnat
@ 1999-01-29  0:00 Paul Moore
  1999-02-10  0:00 ` John Walker
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Moore @ 1999-01-29  0:00 UTC (permalink / raw)


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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Win32: Using COM from Gnat
  1999-02-10  0:00   ` David Botton
@ 1999-02-10  0:00     ` David Botton
       [not found]       ` <01be5729$4fcf8bb0$022a6282@dieppe>
  0 siblings, 1 reply; 5+ messages in thread
From: David Botton @ 1999-02-10  0:00 UTC (permalink / raw)


I also now have an example of creating a COM object with Ada completed,
but am having problems with GNATs ability to create working DLLs (or my
ability to convince it to do so). The Dlls work on NT, but not on my
Win98 machine. Any one have any ideas?

David Botton


David Botton wrote:
> 
> I am sure he is referring to my example on The Ada Source Code Treasury -
> http://www.botton.com/ada
> 
> The COM example there (and the one I am working on now to create
> COM objects) are intended to show the underlying interface of Ada to COM. I
> should certainly hope that some one who will be doing a lot of
> COM programming will package things in a more Ada manner as your bindings
> do.
> 
> David Botton
> 
> John Walker wrote:
> 
> > >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...
> 
> > I hope this doesn't turn out to be the "beep the speaker" example you
> > refer to!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Win32: Using COM from Gnat
  1999-01-29  0:00 Win32: Using COM from Gnat Paul Moore
@ 1999-02-10  0:00 ` John Walker
  1999-02-10  0:00   ` David Botton
  0 siblings, 1 reply; 5+ messages in thread
From: John Walker @ 1999-02-10  0:00 UTC (permalink / raw)


In article <36b1c4dc.19475234@news.origin-it.com>, Paul Moore
<paul.moore@uk.origin-it.com> 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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Win32: Using COM from Gnat
  1999-02-10  0:00 ` John Walker
@ 1999-02-10  0:00   ` David Botton
  1999-02-10  0:00     ` David Botton
  0 siblings, 1 reply; 5+ messages in thread
From: David Botton @ 1999-02-10  0:00 UTC (permalink / raw)


I am sure he is referring to my example on The Ada Source Code Treasury -
http://www.botton.com/ada

The COM example there (and the one I am working on now to create
COM objects) are intended to show the underlying interface of Ada to COM. I
should certainly hope that some one who will be doing a lot of
COM programming will package things in a more Ada manner as your bindings
do.

David Botton


John Walker wrote:

> >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...

> I hope this doesn't turn out to be the "beep the speaker" example you
> refer to!





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Win32: Using COM from Gnat
       [not found]       ` <01be5729$4fcf8bb0$022a6282@dieppe>
@ 1999-02-14  0:00         ` David Botton
  0 siblings, 0 replies; 5+ messages in thread
From: David Botton @ 1999-02-14  0:00 UTC (permalink / raw)
  To: Pascal Obry

Did you DLLs include any calls to the Win32 binding? That seems to be
where the problem starts.

I have put up the COM example, If you have the time see if you can get
it to compile and run on GNAT under Win9x.

David Botton


Pascal Obry wrote:
> 
> David Botton <David@Botton.com> a �crit dans l'article
> <36C256D3.933B3038@Botton.com>...
> > I also now have an example of creating a COM object with Ada completed,
> > but am having problems with GNATs ability to create working DLLs (or my
> > ability to convince it to do so). The Dlls work on NT, but not on my
> > Win98 machine. Any one have any ideas?
> 
> I have never tried under Windows 98 but I have some DLLs that are working
> fine under Windows 95 OSR2 and Windows NT.
> 
> Pascal.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-02-14  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-29  0:00 Win32: Using COM from Gnat Paul Moore
1999-02-10  0:00 ` John Walker
1999-02-10  0:00   ` David Botton
1999-02-10  0:00     ` David Botton
     [not found]       ` <01be5729$4fcf8bb0$022a6282@dieppe>
1999-02-14  0:00         ` David Botton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox