comp.lang.ada
 help / color / mirror / Atom feed
From: "David Botton" <David@Botton.com>
To: <comp.lang.ada@ada.eu.org>
Subject: Re: Calling C's fopen from Ada (Aonix compiler)
Date: Tue, 19 Dec 2000 13:18:45 -0500
Date: 2000-12-19T13:18:45-05:00	[thread overview]
Message-ID: <00b401c069e8$1ff912c0$850118ac@dbdell2000> (raw)
In-Reply-To: slrn93u5jr.1ip.gerhard.nospam@lilith.hqd-internal.de

No, char_array will be passed as a char*.

David Botton

----- Original Message -----
From: "Gerhard H�ring" <gerhard.nospam@bigfoot.de>


> I think the error is that you used Char_Array where Interfaces.C.Chars_Ptr
> should be used. So the compiler passes the arguments to fopen in by-value
> instead of by-reference mode. IMO, an interface to fopen should be
something
> like:

<CLIP>

>
> Gerhard H�ring
>
> On Mon, 11 Dec 2000 19:15:52 -0600, Wayne Magor <none@nowhere.com> wrote:
> >I need to call a C procedure which requires a file pointer (the file
> >must be opened by
> >the caller).  So I want to call C's fopen from Ada (I'm using the Aonix
> >Ada compiler on
> >Windows NT).
> >
> >This causes an access error exception in the program that requires the
> >file pointer, however,
> [snip]
> >  package C renames Interfaces.C;
> >
> >  F : File_Ptr;
> >
> [snip]
> >  function fopen (Name : in C.Char_Array;
> >                  Mode : in C.Char_Array) return File_Ptr;
> >  pragma Import (C, fopen, "fopen");






  parent reply	other threads:[~2000-12-19 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-12  1:15 Calling C's fopen from Ada (Aonix compiler) Wayne Magor
2000-12-12  3:06 ` Robert Dewar
2000-12-19  7:54 ` Gerhard Häring
2000-12-19 15:33   ` Robert Dewar
2000-12-19 18:18   ` David Botton [this message]
2000-12-20  0:31     ` Robert Dewar
replies disabled

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