comp.lang.ada
 help / color / mirror / Atom feed
From: David Botton <David@Botton.com>
Subject: Re: win32ada design question/problem
Date: 1998/11/19
Date: 1998-11-19T00:00:00+00:00	[thread overview]
Message-ID: <365455D5.9A1D0B23@Botton.com> (raw)
In-Reply-To: 365454A8.EFCA84F9@elca-matrix.ch

Mats Weber wrote:

> On the other hand,
>
>    type String_Access is access String;
>
>    function C_Function (X : in String_Access);
>
>    C_Function(S'Unchecked_Access);
>
> will sometimes not work because some compilers (and that includes GNAT)
> use fat pointers for access to unconstrained arrays (I am not saying
> that this is bad).
>
> so you have to do this instead:
>
>    C_Function(S(S'first)'Unchecked_Access);
>
> which does not make clear that S is passed as a whole.
>
> The second problem is that people see a compiler message like "object
> has accessibility level deeper than access type" and instead of using
> 'Unchecked_Access, they move the declaration to the library level and
> create non task safe code. I am not making this up, see the samples
> directory that comes with the win32ada binding.

Why wouldn't you use:

function C_Function ( X : C.char_array ) returns C.Int;
-- int c_function ( char* x);

pragma Import (C, C_Function);

From my understanding it will be passed by_referrence, ie. as a char *


For other record types

type Z is record
    a : C.Int;
end record;

pragma Convention(C, Z);

procedure C_Procedure ( Y : Z );
-- void* c_procedure ( z* y );

pragma Import  (C, C_Procedure);

David Botton






  reply	other threads:[~1998-11-19  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-13  0:00 win32ada design question/problem Mats Weber
1998-11-13  0:00 ` dennison
1998-11-16  0:00   ` Stephen Leake
1998-11-16  0:00     ` Tucker Taft
1998-11-17  0:00     ` dennison
1998-11-17  0:00       ` Mats Weber
1998-11-17  0:00         ` dennison
1998-11-17  0:00           ` Mats Weber
1998-11-17  0:00           ` Tucker Taft
1998-11-18  0:00             ` Tom Moran
1998-11-18  0:00               ` dennison
1998-11-13  0:00 ` Tom Moran
1998-11-16  0:00   ` Mats Weber
1998-11-18  0:00     ` Tom Moran
1998-11-18  0:00       ` dennison
1998-11-19  0:00       ` Mats Weber
1998-11-19  0:00       ` Mats Weber
1998-11-19  0:00         ` David Botton [this message]
1998-11-19  0:00           ` Mats Weber
1998-11-23  0:00             ` Marin David Condic
1998-11-19  0:00         ` dennison
1998-11-19  0:00           ` David Botton
1998-11-27  0:00     ` Roga Danar
  -- strict thread matches above, loose matches on Subject: below --
1998-11-19  0:00 tmoran
1998-11-19  0:00 ` dennison
1998-11-19  0:00   ` Tom Moran
1998-11-20  0:00     ` dennison
1998-11-20  0:00       ` Tom Moran
1998-11-23  0:00     ` Marin David Condic
1998-11-23  0:00       ` Mats Weber
1998-11-24  0:00         ` dennison
replies disabled

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