TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Jeffrey Carter <[log in to unmask]>
Reply To:
Jeffrey Carter <[log in to unmask]>
Sun, 28 Jan 2001 22:04:58 -0600
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