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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ef6c792702c0ff46 X-Google-Attributes: gid103376,public From: Al Johnston Subject: Re: ada to c interfaces and CHARS_PTR Date: 2000/03/09 Message-ID: <38C81310.41EB934A@mindspring.com>#1/1 X-Deja-AN: 595324512 Content-Transfer-Encoding: 7bit References: <38C7E515.29C42580@mindspring.com> X-Accept-Language: en X-Server-Date: 9 Mar 2000 21:11:41 GMT Content-Type: text/plain; charset=us-ascii Organization: MindSpring Enterprises Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-03-09T21:11:41+00:00 List-Id: > C has not 'in out' parameters, only 'in' parameters. To pass the ???? Although I am still trying to figure this stuff out, it seems to me that c as as much of an in/out as any other language has. To effect a "in out" or "out" at the lowest level you are always passing the address of a thing to write to. C just lets you have that method only, where other languages "hide" this from you by there abstract "in out" methods. When It comes down to it a language's means for implementing a inout/out argument is to pass it by reference. this is what you do when you say "char **foo" in c. The only exception I have found to this rule is ada, where a inout/out may actually, according to the RM/Rat be passed by value and then copied back. But the RM explicitly says that passing by value is NOT allowed if the convention "c" applies. Since this routine is a pragma import(c,...) then the out/inout are done by reference, and therefore should be adding the second level of indirection that is being used by ada.... But then again, I could by totally wrong about this... but it is my current understanding... IN ANY case, I ask for a way using CHARS_PTR; your solution uses system.address... I have this stuff working in various places using system.address. The reason I ask about CHARS_PTR is that I thought the whole point of the Anx B stuff was so that you did not have to use such dangerous things as system.address anymore. Maybe this is where I am wrong... The Rat seems to be saying you can do this, but it doesn't give an example, and gnat doesn't seem to do this in its code either... still looking for help/guidance -al