comp.lang.ada
 help / color / mirror / Atom feed
From: "Luke A. Guest" <laguest@archeia.com>
Subject: Re: Coding access to a C's pointer - pointer
Date: Sat, 6 Jun 2020 17:50:09 +0100
Date: 2020-06-06T17:50:09+01:00	[thread overview]
Message-ID: <rbghh7$193u$1@gioia.aioe.org> (raw)
In-Reply-To: dc1dd87e-c7dd-4ed8-a3eb-918362a8f9feo@googlegroups.com

On 06/06/2020 17:23, Bob Goddard wrote:
> I'm trying to shoehorn net-snmp into an Ada conversion and I've hit a roadblock.
> 
> snmp_synch_response requires a pointer to a pointer:
> snmp_synch_response(netsnmp_session *, netsnmp_pdu *, netsnmp_pdu **)
> 
> Just how the heck do you code that? You can't just declare a System.Address.
> 
> Would I need to drop into C and handle it there?

Yup, C's pointer crap is horrible in Ada.

Essentially, you need to create your types netsnmp_session and netsnmp_pdu.

Let's assume your package name is SNMP.

type Session is null record with
  Convention => C; -- You may has this as an actual full record for al I
know.

You can probably get away with * parameters as "in out" parameters in
the Ada function.

You can do ** by creating a C convention access type to PDU and then
another to that.


  reply	other threads:[~2020-06-06 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-06 16:23 Coding access to a C's pointer - pointer Bob Goddard
2020-06-06 16:50 ` Luke A. Guest [this message]
2020-06-06 16:59 ` Niklas Holsti
2020-06-06 17:01 ` Dmitry A. Kazakov
2020-06-06 17:34   ` Bob Goddard
2020-06-06 18:48     ` Dmitry A. Kazakov
2020-06-06 20:20 ` Jeffrey R. Carter
2020-06-06 20:51   ` Björn Lundin
2020-06-06 20:55   ` Jeffrey R. Carter
2020-06-07  7:29     ` Dmitry A. Kazakov
replies disabled

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