comp.lang.ada
 help / color / mirror / Atom feed
* Microsoft UWP/WinRt
@ 2017-06-02  1:23 alby.gamper
  2017-06-02  7:24 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 12+ messages in thread
From: alby.gamper @ 2017-06-02  1:23 UTC (permalink / raw)


Hello Ada community

Would anyone be interested in a set of Ada bindings to the new Microsoft
UWP/WinRT api ?. This would enable Ada to be used to develop native Windows Store
applications and also allow parts of the Api to be used from Desktop applications
as well. (Note, as documented by Microsoft, only a subset of the WinRT api can
be used by traditional desktop applications)

Below is a very simple sample of what the bindings would look like

procedure Test4 is

			procedure ConnectAsync_Callback (asyncInfo : Windows.Foundation.IAsyncAction ; asyncStatus : Windows.Foundation.AsyncStatus) is
				Hr			: Windows.HRESULT := 0;
				m_RetVal	: aliased Windows.Void;
			begin
				Hr := asyncInfo.GetResults(m_RetVal'access);
				Put_Line("Callback Invoked - connected to www.microsoft.com");
			end;

			Hr						: Windows.HRESULT := 0;
			m_RetVal				: aliased Windows.Void;
			m_HostNameFactory		: HostNameFactory;
			m_IHostName				: IHostName;
			m_StreamSocket			: StreamSocket;
			m_IAsyncAction			: IAsyncAction;						
			m_AsyncActionCompleted	: AsyncActionCompletedHandler := new AsyncActionCompletedHandler_Interface(ConnectAsync_Callback'access);

		begin
			m_IHostName := m_HostNameFactory.CreateHostName(To_String("www.microsoft.com"));
			m_IAsyncAction := m_StreamSocket.ConnectAsync(m_IHostName, To_String("http"));
			Hr := m_IAsyncAction.put_Completed(m_AsyncActionCompleted, m_RetVal'access);
			delay 5.0;
			m_StreamSocket.Close;
		end;

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

* Re: Microsoft UWP/WinRt
  2017-06-02  1:23 Microsoft UWP/WinRt alby.gamper
@ 2017-06-02  7:24 ` Dmitry A. Kazakov
  2017-06-02 12:27   ` Lucretia
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry A. Kazakov @ 2017-06-02  7:24 UTC (permalink / raw)


On 02/06/2017 03:23, alby.gamper@gmail.com wrote:

> Would anyone be interested in a set of Ada bindings to the new Microsoft
> UWP/WinRT api ?. This would enable Ada to be used to develop native Windows Store
> applications and also allow parts of the Api to be used from Desktop applications
> as well. (Note, as documented by Microsoft, only a subset of the WinRT api can
> be used by traditional desktop applications)

I don't think there would be much interest in that. Ada's strength is in 
developing portable software. So unless UWP runs on Linux, VxWorks etc 
few would invest much time into it.

Another point is that Microsoft API is pretty much low-level (which is 
OK by itself). So it is not a big deal to call individual operations 
from Ada program without any bindings. Though one could expect that 
AdaCore would expand Win32Ada with these.

The point is about having thick bindings to make it useful/usable, e.g. 
hiding Windows handles in controlled wrappers, enumeration and variant 
record parameters etc. That would be more work than calls you presented.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


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

* Re: Microsoft UWP/WinRt
  2017-06-02  7:24 ` Dmitry A. Kazakov
@ 2017-06-02 12:27   ` Lucretia
  2017-06-02 13:28     ` Dmitry A. Kazakov
  2017-06-08 15:31     ` Pascal Obry
  0 siblings, 2 replies; 12+ messages in thread
From: Lucretia @ 2017-06-02 12:27 UTC (permalink / raw)


On Friday, 2 June 2017 08:24:19 UTC+1, Dmitry A. Kazakov  wrote:
> On 02/06/2017 03:23, alby.gamper@ wrote:
> 
> > Would anyone be interested in a set of Ada bindings to the new Microsoft
> > UWP/WinRT api ?. This would enable Ada to be used to develop native Windows 
Store

You really should be doing something you are interested in.

> > applications and also allow parts of the Api to be used from Desktop applications
> > as well. (Note, as documented by Microsoft, only a subset of the WinRT api can
> > be used by traditional desktop applications)
> 
> I don't think there would be much interest in that. Ada's strength is in 
> developing portable software. So unless UWP runs on Linux, VxWorks etc 
> few would invest much time into it.

That's a bit narrow minded, imo. One part of portable software is os level bindings. So, yes, someone will find them useful. 
 
> Another point is that Microsoft API is pretty much low-level (which is 
> OK by itself). So it is not a big deal to call individual operations 
> from Ada program without any bindings. Though one could expect that 
> AdaCore would expand Win32Ada with these.

Never heard of Win32Ada, where's this then?
 
> The point is about having thick bindings to make it useful/usable, e.g. 
> hiding Windows handles in controlled wrappers, enumeration and variant 
> record parameters etc. That would be more work than calls you presented.

Yes, thick bindings are always better.

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

* Re: Microsoft UWP/WinRt
  2017-06-02 12:27   ` Lucretia
@ 2017-06-02 13:28     ` Dmitry A. Kazakov
  2017-06-02 14:53       ` gautier_niouzes
  2017-06-08 15:31     ` Pascal Obry
  1 sibling, 1 reply; 12+ messages in thread
From: Dmitry A. Kazakov @ 2017-06-02 13:28 UTC (permalink / raw)


On 02/06/2017 14:27, Lucretia wrote:

> Never heard of Win32Ada, where's this then?

It comes with GNAT GPL and Pro for Windows.

It is [necessarily] never complete, yet contains all essential Windows 
API parts (def, crt, ole, base etc). It is thin bindings and quite easy 
to extend if something is amiss.

Win32Ada is used less frequently because GNAT provides a nice set of 
OS-abstraction packages (GNAT sockets, serial COMM etc) and because for 
GUI design Gtk, Qt, Gnoga are more attractive.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

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

* Re: Microsoft UWP/WinRt
  2017-06-02 13:28     ` Dmitry A. Kazakov
@ 2017-06-02 14:53       ` gautier_niouzes
  2017-06-02 14:56         ` Dmitry A. Kazakov
  2017-06-02 21:11         ` Randy Brukardt
  0 siblings, 2 replies; 12+ messages in thread
From: gautier_niouzes @ 2017-06-02 14:53 UTC (permalink / raw)


> Win32Ada is used less frequently because GNAT provides a nice set of 
> OS-abstraction packages (GNAT sockets, serial COMM etc) and because for 
> GUI design Gtk, Qt, Gnoga are more attractive.

Not forgetting GWindows (for Windows only) !...

Gautier
___________________________________________________
A free online game in Ada: http://pasta.phyrama.com


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

* Re: Microsoft UWP/WinRt
  2017-06-02 14:53       ` gautier_niouzes
@ 2017-06-02 14:56         ` Dmitry A. Kazakov
  2017-06-02 21:11         ` Randy Brukardt
  1 sibling, 0 replies; 12+ messages in thread
From: Dmitry A. Kazakov @ 2017-06-02 14:56 UTC (permalink / raw)


On 2017-06-02 16:53, gautier_niouzes@hotmail.com wrote:
>> Win32Ada is used less frequently because GNAT provides a nice set of
>> OS-abstraction packages (GNAT sockets, serial COMM etc) and because for
>> GUI design Gtk, Qt, Gnoga are more attractive.
> 
> Not forgetting GWindows (for Windows only) !...

Well, IMO if Windows only then Windows bindings only.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


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

* Re: Microsoft UWP/WinRt
  2017-06-02 14:53       ` gautier_niouzes
  2017-06-02 14:56         ` Dmitry A. Kazakov
@ 2017-06-02 21:11         ` Randy Brukardt
  1 sibling, 0 replies; 12+ messages in thread
From: Randy Brukardt @ 2017-06-02 21:11 UTC (permalink / raw)


<gautier_niouzes@hotmail.com> wrote in message 
news:6726e56e-6c49-433e-ac4e-0d31d287c822@googlegroups.com...
>> Win32Ada is used less frequently because GNAT provides a nice set of
>> OS-abstraction packages (GNAT sockets, serial COMM etc) and because for
>> GUI design Gtk, Qt, Gnoga are more attractive.
>
> Not forgetting GWindows (for Windows only) !...

And of course Claw (which GWindows was a knock-off of).

                  Randy.


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

* Re: Microsoft UWP/WinRt
  2017-06-02 12:27   ` Lucretia
  2017-06-02 13:28     ` Dmitry A. Kazakov
@ 2017-06-08 15:31     ` Pascal Obry
  2017-06-14  5:43       ` Microsoft UWP/WinRT - Update alby.gamper
  2017-06-18  2:03       ` JEDI, Win32Ada and GNAT-COM Ivan Levashev
  1 sibling, 2 replies; 12+ messages in thread
From: Pascal Obry @ 2017-06-08 15:31 UTC (permalink / raw)


Le vendredi 02 juin 2017 à 05:27 -0700, Lucretia a écrit :
> Never heard of Win32Ada, where's this then?

Here:
https://github.com/AdaCore/win32ada

Since some hours!

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B

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

* Microsoft UWP/WinRT - Update
  2017-06-08 15:31     ` Pascal Obry
@ 2017-06-14  5:43       ` alby.gamper
  2017-06-18  1:15         ` Ivan Levashev
  2017-06-18  2:03       ` JEDI, Win32Ada and GNAT-COM Ivan Levashev
  1 sibling, 1 reply; 12+ messages in thread
From: alby.gamper @ 2017-06-14  5:43 UTC (permalink / raw)


On Friday, June 9, 2017 at 1:31:37 AM UTC+10, Pascal Obry wrote:
> Le vendredi 02 juin 2017 à 05:27 -0700, Lucretia a écrit :
> > Never heard of Win32Ada, where's this then?
> 
> Here:
> https://github.com/AdaCore/win32ada
> 
> Since some hours!
> 
> -- 
>   Pascal Obry /  Magny Les Hameaux (78)
> 
>   The best way to travel is by means of imagination
> 
>   http://www.obry.net
> 
>   gpg --keyserver keys.gnupg.net --recv-key F949BD3B

Dear Ada Community

I have managed to get the WinRt bindings into a usable state
and have managed to create a "Windows Store" application. But
the Windows App certification Fails, since the underlying
Ada runtime, ie libgnat uses api's that are restricted, Thus
preventing the application from being distributed via the "Windows
Store".

However it can be installed and run on a local PC)
Shown below is the application code which loads up some XAML
Over the coming weeks I will try and put together a demo/video clip
demonstrating the technology in its entirety.

--------------------------------------------------------------------------------

with Windows.UI.Xaml.Markup;				use Windows.UI.Xaml.Markup;
with Common;								use Common;

--------------------------------------------------------------------------------
package body AppOverrides is

	----------------------------------------------------------------------------
	overriding function OnLaunched
	(
		This : access MyAppOverrides_Interface;
		args : Windows.ApplicationModel.Activation.ILaunchActivatedEventArgs
	)
	return Windows.HRESULT is

		Hr				: HResult := S_OK;
		m_IWindow		: IWindow;
		m_Window		: Window;
		m_XamlReader	: XamlReader;	
		m_XamlContent	: Wide_String :=

			"<TextBlock xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" " &
			"   Name=""Text"" TextAlignment=""Center"" HorizontalAlignment=""Center"" " &
			"   VerticalAlignment=""Center"" FontSize=""32""> " &
			"   <Run Text=""Hello World application - written in Ada""/> " &
			"   <LineBreak/> " &
			"   <Run Text=""Target - Windows Store Application (Xaml)""/> " &
			"</TextBlock>";
		
		m_Object		: Windows.Object;
		m_IUIElement	: aliased IUIElement := null;

	begin

		m_IWindow := m_Window.get_Current;
		m_Object := m_XamlReader.Load(To_String(m_XamlContent));
		Hr := m_Object.QueryInterface(IID_IUIElement'access, m_IUIElement'address);
		Hr := m_IWindow.put_Content(m_IUIElement);
		Hr := m_IWindow.Activate;
		return Hr; 

	end;

end;

Alex


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

* Re: Microsoft UWP/WinRT - Update
  2017-06-14  5:43       ` Microsoft UWP/WinRT - Update alby.gamper
@ 2017-06-18  1:15         ` Ivan Levashev
  0 siblings, 0 replies; 12+ messages in thread
From: Ivan Levashev @ 2017-06-18  1:15 UTC (permalink / raw)


14.06.2017 12:43, alby.gamper@gmail.com пишет:
> Dear Ada Community
>
> I have managed to get the WinRt bindings into a usable state
> and have managed to create a "Windows Store" application. But
> the Windows App certification Fails, since the underlying
> Ada runtime, ie libgnat uses api's that are restricted, Thus
> preventing the application from being distributed via the "Windows
> Store".
>
> However it can be installed and run on a local PC)
> Shown below is the application code which loads up some XAML
> Over the coming weeks I will try and put together a demo/video clip
> demonstrating the technology in its entirety.

Hi! That's great news. If you tracked Delphi WinRT support attempts, you 
must have been familiar with yells that Microsoft tried to substitute 
all the great diversity of native programming languages including Delphi 
and Ada with only those ones supported by Microsoft's retarded compilers.

http://www.deltics.co.nz/blog/posts/1080

This history has a good end. Starting from Windows 10 Anniversary Update 
(summer 2016) Windows has got Project Centennial support, and this is a 
hole through which everybody can get into Windows Store and not 
sacrifice quality by picking worse programming language. Say screw you 
to Microsoft Visual C++ and say hi to GNAT.

https://channel9.msdn.com/Events/Build/2015/2-692
https://developer.microsoft.com/en-us/windows/bridges/desktop

It took half a year for Embarcadero to adapt Delphi, and in the Delphi 
10.1 Berlin Anniversary Update 2 they have introduced Windows Store 
support via Project Centennial.

https://community.embarcadero.com/blogs/entry/windows-10-from-winrt-to-centennial-with-marco-cantu

The current version of Delphi is 10.2, and Starter edition can be 
obtained for free here:

https://www.embarcadero.com/ru/products/delphi/starter/promotional-download

You'll get serial on e-mail. If you want to save installer for future, 
you can find offline installers here:

http://cc.embarcadero.com/myreg

You can install both Delphi Starter and C++ Builder Starter, but you'll 
need to get another serial key from Embarcadero website.

You'll get an opportunity to research how it works and repeat the same 
for Ada. No need to learn these lessons from the beginning.

Best Regards,
Ivan Levashev,
Barnaul

--
If you want to get to the top, you have to start at the bottom

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

* JEDI, Win32Ada and GNAT-COM
  2017-06-08 15:31     ` Pascal Obry
  2017-06-14  5:43       ` Microsoft UWP/WinRT - Update alby.gamper
@ 2017-06-18  2:03       ` Ivan Levashev
  2017-07-03 10:14         ` Luke A. Guest
  1 sibling, 1 reply; 12+ messages in thread
From: Ivan Levashev @ 2017-06-18  2:03 UTC (permalink / raw)


08.06.2017 22:31, Pascal Obry пишет:
>
> Here:
> https://github.com/AdaCore/win32ada
>
If anybody is interested (in terms of funding), I can think about 
reviving JEDI to Ada converter.

https://bitbucket.org/OCTAGRAM/winapi-delphi-to-ada/src/4e966fc13369c6b5d482df9983be97415aaee6dd/Icon-Win32API/Win32API_out/Jwa.Win_Con.ads?at=default&fileviewer=file-view-default

JEDI has WinAPI bindings for Delphi, and Delphi is similar to Ada in 
some sense. I.e. in C we have int* parameter, and it can mean "in out 
Integer", "out Integer", "anonymous access to array of Integer" or 
"library-wide access all Integer", that is, the pointer going to be 
stored for future. Delphi also has out and "in out" ("var") arguments 
support, so this can be translated freely.

When Delphi developers write WinAPI bindings for Delphi, they interpret 
what they deal with, and thus bindings become more rich, more convenient 
to work with compared to bindings produced from Platform SDK C headers. 
They sometimes make overloaded versions of the same functions because 
some API have different ways of use, e.g. some parameter can be null or 
non-null determining meaning of other parameters, and JEDI bindings has 
one version where null pointer can be passed, and another one has "in 
out" ("var") parameter in the same place. JEDI is being actively used, 
so these interpretations proved to be useful for some real developers 
already.

Win32Ada seems to have been produced with neither accounting Delphi 
developers' work nor repeating the same work independently and is 
comparably less soulful, less convenient.

The same goes to GNAT-COM. In Delphi interface references were using ARC 
long before it appeared in Objective-C. It's very unlikely to do 
something wrong while working with them. Wherever exception is raised, 
there won't be COM objects leaked due to missed IUnknown.Release call. 
Ada is better than Delphi, so I expected GNAT-COM to naturally provide 
at least the same level of confidence, but instead I was very surprised 
to meet unsafe naked references crying from every corner to be leaked on 
any unpredicted exception, and recall, Ada doesn't have try-finally, so 
there is no convenient way to handle them other than by using Controlled.

Delphi and Ada developers being apart is a curse haunting both languages 
for so many years. Both ecosystems lost from unawareness of each other.

WinRT stands on top of WinAPI and COM, so implementing WinRT support in 
Ada brings us back to old unsolved problems.

Best Regards,
Ivan Levashev,
Barnaul

--
If you want to get to the top, you have to start at the bottom

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

* Re: JEDI, Win32Ada and GNAT-COM
  2017-06-18  2:03       ` JEDI, Win32Ada and GNAT-COM Ivan Levashev
@ 2017-07-03 10:14         ` Luke A. Guest
  0 siblings, 0 replies; 12+ messages in thread
From: Luke A. Guest @ 2017-07-03 10:14 UTC (permalink / raw)


I'm not sure Delphi and Ada being apart is that hurtful, Ada is very
different to Pascal. Ada defines types, Pascal really doesn't.

Ask David Botton about GNATCOM as he wrote it before giving it to AdaCore.
Also check if there are license requirements on the generated source.


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

end of thread, other threads:[~2017-07-03 10:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02  1:23 Microsoft UWP/WinRt alby.gamper
2017-06-02  7:24 ` Dmitry A. Kazakov
2017-06-02 12:27   ` Lucretia
2017-06-02 13:28     ` Dmitry A. Kazakov
2017-06-02 14:53       ` gautier_niouzes
2017-06-02 14:56         ` Dmitry A. Kazakov
2017-06-02 21:11         ` Randy Brukardt
2017-06-08 15:31     ` Pascal Obry
2017-06-14  5:43       ` Microsoft UWP/WinRT - Update alby.gamper
2017-06-18  1:15         ` Ivan Levashev
2017-06-18  2:03       ` JEDI, Win32Ada and GNAT-COM Ivan Levashev
2017-07-03 10:14         ` Luke A. Guest

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