comp.lang.ada
 help / color / mirror / Atom feed
From: sk <noname@myob.com>
Subject: Re: C lib returns char** - How in ADA?
Date: Thu, 30 May 2002 02:56:37 -0500
Date: 2002-05-30T02:56:37-05:00	[thread overview]
Message-ID: <mailman.1022745482.14345.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: pan.2002.05.30.02.29.15.879907.5334@cowgar.com


Hi, 

I mistakenly hit the send before finishing ...

Have a look at package Interfaces.C.Strings in the
references manual. The package provides :

type char_array_access is access all char_array;
type chars_ptr is private;
type chars_ptr_array is array (size_t range <>) of chars_ptr;

which appears to be what you are looking for.

+++

Then look at Interfaces.C.Pointers.

It gets tricky since you are importing a non-Ada object, but

    package IC  renames Interfaces.C;
    package ICS renames Interfaces.C.Strings;
    package ICP is new Interfaces.C.Pointers (
        Index => IC.Size_t,
        Element => ICS.Chars_Ptr,
        Element_Array => ICS.Chars_Ptr_Array,
        Default_Terminator => ???????
    );

Cannot remember what <???????> should be,

   ICP.Copy_Terminated_Array (...)

should get the foreign data structure into your
application.

Its been a while since I played with this, so details
are fuzzy .. except that I quickly found a hack to
replace the way you are supposed to do it described 
above :-)

-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



  parent reply	other threads:[~2002-05-30  7:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-30  6:34 C lib returns char** - How in ADA? Jeremy Cowgar
2002-05-30  7:42 ` sk
2002-05-30  7:56 ` sk [this message]
2002-05-30  7:57 ` tmoran
2002-05-30 16:32 ` Pascal Obry
2002-05-31  0:28   ` Jeremy Cowgar
2002-05-31 18:46     ` Pascal Obry
replies disabled

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