From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.jFK6OqqKW5bkmQ4H/i1UAQ.user.gioia.aioe.org!not-for-mail From: "Luke A. Guest" Newsgroups: comp.lang.ada Subject: Re: Coding access to a C's pointer - pointer Date: Sat, 6 Jun 2020 17:50:09 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: jFK6OqqKW5bkmQ4H/i1UAQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-GB Xref: reader01.eternal-september.org comp.lang.ada:58984 Date: 2020-06-06T17:50:09+01:00 List-Id: 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.