From: do_while@lo-pan.ridgecrest.ca.us (Do-While Jones)
Subject: Re: Pragma Import to C "Accept" function?
Date: 1997/02/13
Date: 1997-02-13T00:00:00+00:00 [thread overview]
Message-ID: <5dv9kc$3sr@ash.ridgecrest.ca.us> (raw)
In-Reply-To: 5ds893$qgf@bs33n.staffs.ac.uk
In article <5ds893$qgf@bs33n.staffs.ac.uk> cm3bcawp@bs47c.staffs.ac.uk (Al Priest) writes:
>I'm looking for a "nice" way to interface to the C accept function. Given
>it's clash with the reserved word accept, is there a good way to interface
>to the function? Currently the only way I can do it is by writing a C
>function to interface to the accept, and then interfacing to that in my
>Ada program.
>
>I'm using latest (Jan'97) version of Gnat compiler for Linux in case it
>matters.
>
>Thanks,
>
>Al
>--
>al@priest.com
Here's how I do it.
(I don't normally use lower case for function names and variable names,
but I did here because I was matching the C names.)
function accept_connection(
socket : in Socket_numbers;
addr : in SYSTEM.Address;
addrlen : in SYSTEM.Address)
return Socket_numbers;
pragma Interface (C, accept_connection);
pragma Interface_Information
(accept_connection, "_accept");
The code above works for Telesoft Telegen 2 on a Sun workstation. To
make it run on Verdix on a Silicon Graphic machine I had to change the
last pragma to
pragma Interface_Name
(accept_connection, "accept");
Both versions of this interface have run for years without problems.
Do-While Jones
--
+--------------------------------+
| Know Ada |
| [Ada's Portrait] |
| Will Travel |
| wire do_while@ridgecrest.ca.us |
+--------------------------------+
next prev parent reply other threads:[~1997-02-13 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-02-12 0:00 Pragma Import to C "Accept" function? Al Priest
1997-02-12 0:00 ` Samuel Tardieu
1997-02-13 0:00 ` Do-While Jones [this message]
1997-02-20 0:00 ` Samuel Mize
1997-02-24 0:00 ` Robert Dewar
1997-03-04 0:00 ` Al Priest
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox