TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Transfer-Encoding: 7bit
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: Jeffrey Carter <[log in to unmask]>
Date: Sun, 28 Jan 2001 22:04:58 -0600
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
Reply-To: Jeffrey Carter <[log in to unmask]>
Parts/Attachments: text/plain (23 lines)
Stephane Richard wrote:
> I have a question, lets say I wish to interface a c++ function or a windows
> API that requires a pointer in it's parameters.
> What would I pass to this function in Ada?   is tehre a AddressOf() command
> to simulate a pointer for a Standard C or API function call?

This cannot be answered without knowing what the function does, with the
parameter and in general. C/++ function prototypes do not specify how a
function uses its parameters the way Ada subprogram specifications do.
You either have to rely on comments or read the implementation before
you can correctly call a C/++ function.

In most cases you can simply specify the correct parameter mode (in, in
out, or out) in Ada and the compiler will pass the correct information
to the function. In some cases, most noticeably a function that returns
a result and also modifies its parameter, an access parameter is needed.

Jeff Carter
"English bed-wetting types."
Monty Python & the Holy Grail