comp.lang.ada
 help / color / mirror / Atom feed
* how to pass access string across pragma C interface?
@ 1997-06-19  0:00 burch
  1997-06-20  0:00 ` Anonymous
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: burch @ 1997-06-19  0:00 UTC (permalink / raw)



I'm using Ada83 with the Alsys compiler and I'm having problems getting
access strings to pass to C char* across the pragma interface call.  What
kind of type definitions does one have to do on the Ada side to get the
types to match up?  This is what I've done so far, which gives a
constraint error on run time.
	type string_access_type is access string( 1 ..2048);

	function read_func (
             socket_fd : in integer;
             buffer : in string_access_type
             ) return integer;
        pragma interface ( C , read_func );
        pragma interface_name( read_func, "read" );

			.
			.
			.
       begin


  			.
			.
       status_read := read_func ( socket_fd, buffer );

the C function "read" is

int read (int, char*);

What I'm trying to accomplish is to have "buffer" passed by reference to
C.  C will go out and get the string from a socket, return, and
(hopefully) I'll be able to use it back on the Ada side.

I'm new with with Ada, so any comments for my learning would be
appreciated.  Thank you in advance.

Tim Burch
burch@cyberhighway.net

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-06-25  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-19  0:00 how to pass access string across pragma C interface? burch
1997-06-20  0:00 ` Anonymous
1997-06-22  0:00 ` David C. Hoos, Sr.
1997-06-23  0:00   ` Robert Dewar
1997-06-25  0:00     ` Alan Brain
1997-06-24  0:00 ` Matthew Heaney

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