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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9c274893e2f7e55 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 12 Jan 2005 21:04:22 -0600 From: "Steve" Newsgroups: comp.lang.ada References: <8e19522cfe30bb2ccbfe1393fdd6b235@localhost.talkaboutprogramming.com> Subject: Re: Ada to C Interface: Passing Pointers Via System.Address Date: Wed, 12 Jan 2005 19:05:17 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: <18GdnfRhAsyreHjcRVn-vg@comcast.com> NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-NIYttrd9sdFSoZHL7hsVad5UmbRa/HdmGA+wlP62a53BivNGOMNy2bXRWSXFDlozlECdfr/grBEGKd2!aRxmwjKD4pKgvkIWYyAAY7cWkEmEbgyEa4R33O7OljB3dvn17eyxMFZ3NMy5 X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.22 Xref: g2news1.google.com comp.lang.ada:7705 Date: 2005-01-12T19:05:17-08:00 List-Id: I have had pretty good luck interfacing C/C++ with Ada. My specific experience has been with Microsoft C and ObjectAda. Things often don't work on my first try, but that's usually because I wasn't careful enough in setting up the C interface pragmas or didn't declare functions in C++ using "external C". Steve (The Duck) "ReversedBias" wrote in message news:8e19522cfe30bb2ccbfe1393fdd6b235@localhost.talkaboutprogramming.com... >I am relatively new to Ada. I am constructing an API so that my Ada > clients can talk to my C code. My C functions return pointers to data > structures (very large structures). I need to then pass the pointer to > the data struct to the Ada code and back into other C functions. There is > no interaction with the data structure in the Ada code except to pass the > pointer from one C function to another. I have been trying to use the C > interface pragma and return the pointers from C into an Ada System.Address > and then pass that System.Address into the another pragma back down to the > C functions. My hope is that the C will be able to type cast the address > back into the correct pointer type. So far I have not been able to get > this to work properly. Please advise on another approach or post an > example of how I could do this using the System.Address > > Thanks, >