comp.lang.ada
 help / color / mirror / Atom feed
From: matthewbrentmccarty@gmail.com
Subject: Re: differences between Ada and C in gnat forcing me to use C instead of Ada
Date: Mon, 25 Mar 2019 07:09:18 -0700 (PDT)
Date: 2019-03-25T07:09:18-07:00	[thread overview]
Message-ID: <2afba838-16fd-4d5b-906a-b9cd1d864ce6@googlegroups.com> (raw)
In-Reply-To: <c1aea932-9ae1-4915-a260-b6bc0b24c12c@googlegroups.com>

Hi all:
"gnat-gps" on my machine Windows 10 (debian subsystem for Linux) (see https://docs.microsoft.com/en-us/windows/wsl/install-win10 ) gives me "raised STORAGE_ERROR : s-intman.adb:139 explicit raise" yet the same software works fine on my "real" debian machine. The compiler works but gant-gps doesn't. 


For some reason when I call sane_get_devices as in:

      type Sane_Device_Ptr is access all sane_sane_h.SANE_Device;
      for Sane_Device_Ptr'Size use Standard'Address_Size;
      pragma Convention (C, Sane_Device_Ptr);

      type Device_Array is array (Integer range <>) of aliased Sane_Device_Ptr;
      pragma Convention (C, Device_Array);
      ...
      devices :  aliased  Device_Array (1..5);
      Status := sane_sane_h.sane_get_devices (devices(1)'Address, sane_sane_h.SANE_Bool(SANE_TRUE));

I get back garbage but in C, it works. Oh, now that makes sense about 'Size returning bits and sizeof in C returning bytes. 256 bits is indeed 32 bytes. I wonder why I'm getting back garbage. InterfaceS.C.Strings.chars_ptr'Size=64 and sizeof(char *)=8 are equivalent.

Thanks. I guess I got some more digging to do as to my garbage.

Regards,
Matthew McCarty


  parent reply	other threads:[~2019-03-25 14:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25  5:46 differences between Ada and C in gnat forcing me to use C instead of Ada matthewbrentmccarty
2019-03-25  5:58 ` Jere
2019-03-25  8:25 ` Dmitry A. Kazakov
2019-03-25 14:06   ` Florian Weimer
2019-03-25 10:56 ` Philip Munts
2019-03-25 11:54 ` Lucretia
2019-03-25 14:09 ` matthewbrentmccarty [this message]
2019-03-25 14:20   ` Dmitry A. Kazakov
2019-03-25 16:46     ` Jeffrey R. Carter
2019-03-25 18:01       ` Dmitry A. Kazakov
2019-03-25 17:38   ` Niklas Holsti
2019-03-25 16:42 ` matthewbrentmccarty
2019-03-25 18:18   ` Dmitry A. Kazakov
2019-04-04  0:51     ` matthewbrentmccarty
replies disabled

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