comp.lang.ada
 help / color / mirror / Atom feed
From: "Beard, Frank [Contractor]" <beardf@spawar.navy.mil>
Subject: RE: Binding to functions having reference parameter
Date: Wed, 8 May 2002 14:39:30 -0400
Date: 2002-05-08T14:39:30-04:00	[thread overview]
Message-ID: <mailman.1020883261.22435.comp.lang.ada@ada.eu.org> (raw)

function ApiCmdBite ( bModule     : My_Win32.UCHAR;
                      biu         : My_Win32.UCHAR;
                      sc          : My_Win32.UCHAR;
                      bite_status : access My_Win32.UCHAR_Array2 );

return My_Win32.SHORT;

Then, the variable you have declared to pass to it needs to be
something like:

  new_bite_status : aliased My_Win32.UCHAR_Array2;

So, that when you call it, it will look something like

  return_code := ApiCmdBite ( bModule     => ???,
                              biu         => ???,
                              sc           => ???,
                              bite_status => new_bite_status'access);

Frank

-----Original Message-----
From: Antonio López [mailto:alm@gtd.es.REMOVE]
Sent: Wednesday, May 08, 2002 10:40 AM
To: comp.lang.ada@ada.eu.org
Subject: Binding to functions having reference parameter


I am doing a binding to a Dll Using Win32 binding and I have a problem with
functions having reference parameters (an C array).

¿How must I declare those parameters? (ada functions doesn't allow out
parameters)

One example:

Dll fucntion is declared as :

_API_EXTERN AiInt16 _API_DLL_FUNC ApiCmdBite (AiUInt8 bModule, AiUInt8 biu,
AiUInt8 sc, AiUInt8 bite_status[]);

And I declare:

subtype UCHAR is Interfaces.C.unsigned_char;

type UCHAR_Array2 is array (0 .. 1) of aliased UCHAR;

function ApiCmdBite ( bModule : My_Win32.UCHAR; biu : My_Win32.UCHAR; sc :
My_Win32.UCHAR;

bite_status : My_Win32.UCHAR_Array2 )

return My_Win32.SHORT;

However I get a warning: "bite_status" is never assigned a value, calling
the fucntion.

Obvius It needs to be done otherwise! Could you enlight me please?

I have tried to pass the parameter as bite_status :
Interfaces.C.unsigned_char'Address but I get the error: attribute "Address"
may not be used in a subtype mark

I should be able to use for example: 'bite_status(0) := 1;' or 'if
(bite_status(1) == 2)'



_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada



             reply	other threads:[~2002-05-08 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-08 18:39 Beard, Frank [Contractor] [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-05-08 14:40 Binding to functions having reference parameter Antonio L�pez
2002-05-08 15:19 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox