comp.lang.ada
 help / color / mirror / Atom feed
* GNAT GPL 2015
@ 2015-06-15 15:39 Anh Vo
  2015-06-16 11:56 ` gautier_niouzes
  2015-06-16 13:09 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 8+ messages in thread
From: Anh Vo @ 2015-06-15 15:39 UTC (permalink / raw)


I happened to check http://libre.adacore.com/. Voila, GNAT GPL 2015 is available. I am anxious to download it after getting from my current vacation.

Anh Vo

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

* Re: GNAT GPL 2015
  2015-06-15 15:39 GNAT GPL 2015 Anh Vo
@ 2015-06-16 11:56 ` gautier_niouzes
  2015-06-16 12:14   ` David Botton
                     ` (2 more replies)
  2015-06-16 13:09 ` Dmitry A. Kazakov
  1 sibling, 3 replies; 8+ messages in thread
From: gautier_niouzes @ 2015-06-16 11:56 UTC (permalink / raw)


Looks good!

The only serious hiccup encountered so far (apart of performance loss and the need to remove the -flto switch on a project) is on a subtle Windows DLL version query, which has worked in all versions so far but issues a segmentation fault in GDB, and a STORAGE_ERROR in a standalone run, after ~10 seconds on the function call marked below with ****.

   function Get_Comctl_Version return natural is

      function Getmodulehandle(LpModulname: in Lptstr) return Gwindows.Types.Handle;
      pragma Import(Stdcall, Getmodulehandle, "GetModuleHandle" & Character_Mode_Identifier);

      type Dllversioninfo is
         record
            Cbsize: Interfaces.C.Long := 0;
            majorversion: Interfaces.C.long := 0;
            minorversion: Interfaces.C.long := 0;
            buildnumber: Interfaces.C.long := 0;
            platformid: Interfaces.C.long := 0;
         end record;
      type Dllversioninfo_Pointer is access all Dllversioninfo;

      type Dll_Get_Version_func is access
        function (Versioninfo: in dllversioninfo_pointer) return Interfaces.C.Unsigned_long;
      pragma Convention(C, Dll_Get_Version_func);

      use Interfaces.C;

      function getprocaddress(hmodule: in Gwindows.Types.Handle;
                              Lpprocname: in Char_array)
                             return dll_get_version_func;
      pragma Import(Stdcall, getprocaddress, "GetProcAddress");

      libname: Gstring_C := Gwindows.Gstrings.To_Gstring_C("comctl32");
      Procname: aliased constant Char_Array := To_C("DllGetVersion");
      ModHandle: Gwindows.Types.Handle;
      FuncPtr: Dll_Get_Version_Func;
      Info: aliased Dllversioninfo;
      Ret_Func: Interfaces.C.Unsigned_long;
      pragma Unreferenced (Ret_Func);

   begin
      -- get dll
      modhandle := Getmodulehandle(Lpmodulname => Libname(0)'Unchecked_Access);
      -- get dllgetversion
      funcPtr := Getprocaddress(Hmodule => Modhandle,
                                Lpprocname => procname);
      -- call dllgetversion
      Info.Cbsize := Info'Size / 8;
      Ret_Func := FuncPtr(Info'unchecked_access) ;           -- ****
      Put_Line("Major version...." & Info.majorversion'Img);
      Put_Line("Minor version...." & Info.minorversion'Img);
      Put_Line("Build............" & Info.buildnumber'Img);
      Put_Line("Platform........." & Info.platformid'Img);
      return Natural(Info.MajorVersion);
   exception
      when others =>
         return 0;
   end get_comctl_version;

Any clue, just looking at it ?

Full package around the function is here:
  gwindows-common_controls-ex_list_view.adb
hosted here:
  http://sf.net/p/gnavi/code/HEAD/tree/gwindows/contrib/
It is an extended ListView package.

TIA
_________________________ 
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 



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

* Re: GNAT GPL 2015
  2015-06-16 11:56 ` gautier_niouzes
@ 2015-06-16 12:14   ` David Botton
  2015-06-16 12:23     ` gautier_niouzes
  2015-06-16 13:26   ` G.B.
  2015-06-16 13:39   ` Pascal Obry
  2 siblings, 1 reply; 8+ messages in thread
From: David Botton @ 2015-06-16 12:14 UTC (permalink / raw)


Did you try the query on different DLLs, not every DLL actually exports DllGetVersion? Did the same DLL work before?

David Botton


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

* Re: GNAT GPL 2015
  2015-06-16 12:14   ` David Botton
@ 2015-06-16 12:23     ` gautier_niouzes
  0 siblings, 0 replies; 8+ messages in thread
From: gautier_niouzes @ 2015-06-16 12:23 UTC (permalink / raw)


David Botton a écrit :

> Did the same DLL work before?

Yes. It is a standard Windows DLL (comctl32.dll), BTW.

If you build demo_exlv1.adb from the project file here
  http://sf.net/p/gnavi/code/HEAD/tree/gwindows/gwindows_contrib.gpr
you see what is happenning.
With GNAT GPL < 2014 or with MinGW you would get for instance

Major version.... 6
Minor version.... 16
Build............ 7601
Platform......... 2

If you add @ gwindows-common_controls-ex_list_view.adb:293:

      Put_Line("Major version...." & Info.majorversion'Img);
      Put_Line("Minor version...." & Info.minorversion'Img);
      Put_Line("Build............" & Info.buildnumber'Img);
      Put_Line("Platform........." & Info.platformid'Img);

_________________________ 
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 

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

* Re: GNAT GPL 2015
  2015-06-15 15:39 GNAT GPL 2015 Anh Vo
  2015-06-16 11:56 ` gautier_niouzes
@ 2015-06-16 13:09 ` Dmitry A. Kazakov
  2015-06-16 17:19   ` GNAT GPL 2015 (generics and pool-specific access types) Dmitry A. Kazakov
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2015-06-16 13:09 UTC (permalink / raw)


On Mon, 15 Jun 2015 08:39:19 -0700 (PDT), Anh Vo wrote:

> GNAT GPL 2015 is available.

1. There seems to be an issue with generics (always generics) in Ada 2012
mode. The same code compiles in either 95 or 2005 mode. But in 2012 GNAT
gives "incompatible types" upon instantiation (in a declaration of a
pool-specific access type). I am trying to figure out what is going on.

2. GtkAda is still 3.8.3 which is disappointing.

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


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

* Re: GNAT GPL 2015
  2015-06-16 11:56 ` gautier_niouzes
  2015-06-16 12:14   ` David Botton
@ 2015-06-16 13:26   ` G.B.
  2015-06-16 13:39   ` Pascal Obry
  2 siblings, 0 replies; 8+ messages in thread
From: G.B. @ 2015-06-16 13:26 UTC (permalink / raw)


On 16.06.15 13:56, gautier_niouzes@hotmail.com wrote:
>        funcPtr := Getprocaddress(Hmodule => Modhandle,
>                                  Lpprocname => procname);

shot from the hip:
addresses of functions, functions for local pointers in
particular, might profit from address_to_access_conversions?

Also, is it necessary to have Dllversioninfo_Pointer if,
by Interfaces.C, a record is passed as a struct* anyway?
Does Dllversioninfo need Convention Ada?



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

* Re: GNAT GPL 2015
  2015-06-16 11:56 ` gautier_niouzes
  2015-06-16 12:14   ` David Botton
  2015-06-16 13:26   ` G.B.
@ 2015-06-16 13:39   ` Pascal Obry
  2 siblings, 0 replies; 8+ messages in thread
From: Pascal Obry @ 2015-06-16 13:39 UTC (permalink / raw)


Le mardi 16 juin 2015 à 04:56 -0700, gautier_niouzes@hotmail.com a
écrit :
> 
>       type Dll_Get_Version_func is access
>         function (Versioninfo: in dllversioninfo_pointer) return 
> Interfaces.C.Unsigned_long;
>       pragma Convention(C, Dll_Get_Version_func);

Should stdcall, no?

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

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



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

* GNAT GPL 2015 (generics and pool-specific access types)
  2015-06-16 13:09 ` Dmitry A. Kazakov
@ 2015-06-16 17:19   ` Dmitry A. Kazakov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry A. Kazakov @ 2015-06-16 17:19 UTC (permalink / raw)


On Tue, 16 Jun 2015 15:09:50 +0200, Dmitry A. Kazakov wrote:

> On Mon, 15 Jun 2015 08:39:19 -0700 (PDT), Anh Vo wrote:
> 
>> GNAT GPL 2015 is available.
> 
> 1. There seems to be an issue with generics (always generics) in Ada 2012
> mode. The same code compiles in either 95 or 2005 mode. But in 2012 GNAT
> gives "incompatible types" upon instantiation (in a declaration of a
> pool-specific access type). I am trying to figure out what is going on.

I tracked down the issue. The error appears upon a generic instantiation
when a local access type is declared as pool-specific and the pool object
is class-wide, e.g.

   function Foo (P : Pool) return ... is
      type Ptr is access T;  -- Error, "incompatible types"
      for Ptr'Storage_Pool use P.Self.all; -- Rosen's trick
                     
Self is an access to Pool'Class to work around the in-mode of P. To get it
compiled convert to a specific pool type:

   function Foo (P : Pool) return ... is
      type Ptr is access T; -- Now this is OK
      for Ptr'Storage_Pool use Pool (P.Self.all);

------------------------------------------------------------------------------------------------
Leaving aside the garbage error message, which compiler was wrong, Ada
95-2005 or Ada 2012?

Then there is an interesting question about the behavior of "for" clause.
Is it legal to use a class-wide instance for Storage_Pool object? Say there
are pool types Pool_Parent and Pool_Child derived from it. If Pool_Child
overrides Allocate. Then with

   P : Pool_Child;

which Allocate to be called for an access type Ptr:

1. for Ptr'Storage_Pool use Pool_Parent (P);

Should it "dispatch" to Pool_Child's Allocate?

2. for Ptr'Storage_Pool use Pool_Parent'Class (P);

Is this legal? Should it "dispatch"?

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


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

end of thread, other threads:[~2015-06-16 17:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15 15:39 GNAT GPL 2015 Anh Vo
2015-06-16 11:56 ` gautier_niouzes
2015-06-16 12:14   ` David Botton
2015-06-16 12:23     ` gautier_niouzes
2015-06-16 13:26   ` G.B.
2015-06-16 13:39   ` Pascal Obry
2015-06-16 13:09 ` Dmitry A. Kazakov
2015-06-16 17:19   ` GNAT GPL 2015 (generics and pool-specific access types) Dmitry A. Kazakov

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