comp.lang.ada
 help / color / mirror / Atom feed
* Re: Interface programming
  1996-08-19  0:00 Interface programming Ramesh S. Mantri
@ 1996-08-19  0:00 ` Paul Hussein
  1996-08-19  0:00   ` Robert Dewar
  1996-08-19  0:00 ` Robert Dewar
  1996-08-21  0:00 ` Pascal Ledru
  2 siblings, 1 reply; 5+ messages in thread
From: Paul Hussein @ 1996-08-19  0:00 UTC (permalink / raw)



mantri@ponder.csci.unt.edu (Ramesh S. Mantri) wrote:
I think your pragma needs a corresponding interface name pragma.
>Hi,
>	Need help with interface programming. I need to invoke a 
>Square Root function in a program. So I tried interfacing to Fortran
>as follows :
>	procedure SOMEPROC is
>	  package FORT_LIB is
>	    function SQRT(X:FLOAT) return FLOAT;
>	  private
>	    pragma INTERFACE(FORTRAN, SQRT);
                 pragma INTERFACE_NAME ( SQRT, "fortran_SQRT" );
>	  end FORT_LIB;
>	  NUM : INTEGER;
>	  NUMROOT : FLOAT;
>	begin
>	  GET(NUM); 
>	  NUMROOT := SQRT(FLOAT(NUM));
>	end SOMEPROC;
>It is displaying a warning at the "pragma" line, and declaring "SQRT"
>as and undefined identifier, in the line "NUMROOT := SQRT(FLOAT(NUM));".
>If you have time, please take the trouble of informing me as to how to
>rectify this. Also, the warning dispayed at the "pragma" line reads
>approximately as : "... parameter types. SYSTEM.ADDRESS expected..."
>Thanks for your patience.
>--- Ramesh Mantri






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

* Re: Interface programming
  1996-08-19  0:00 Interface programming Ramesh S. Mantri
  1996-08-19  0:00 ` Paul Hussein
@ 1996-08-19  0:00 ` Robert Dewar
  1996-08-21  0:00 ` Pascal Ledru
  2 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1996-08-19  0:00 UTC (permalink / raw)



Ramesh asks about

        procedure SOMEPROC is
          package FORT_LIB is
            function SQRT(X:FLOAT) return FLOAT;
          private
            pragma INTERFACE(FORTRAN, SQRT);
          end FORT_LIB;
          NUM : INTEGER;
          NUMROOT : FLOAT;
        begin
          GET(NUM);
          NUMROOT := SQRT(FLOAT(NUM));
        end SOMEPROC;

SQRT is not directly visible at the point of call, so the compiler is
right to reject it. Indeed the only possible explanation of putting 
the function inside an internal package is to make sure that it is not
directly visible. I suspect some fundamental misunderstanding of
Ada visibility rules here!





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

* Re: Interface programming
  1996-08-19  0:00 ` Paul Hussein
@ 1996-08-19  0:00   ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1996-08-19  0:00 UTC (permalink / raw)



Paul said

"mantri@ponder.csci.unt.edu (Ramesh S. Mantri) wrote:
I think your pragma needs a corresponding interface name pragma."

Nope, firstly interface_name is some kind of implementation dependent
Ada 83 stuff (it is not even part of Ada 83), and is unnecessary in
Ada 95 (though some compilers, such as GNAt support it anyway). But
in any case this is completely irrelevant to the problem which was
one of direct visibility, which is of course not affected by pragmas.





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

* Interface programming
@ 1996-08-19  0:00 Ramesh S. Mantri
  1996-08-19  0:00 ` Paul Hussein
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ramesh S. Mantri @ 1996-08-19  0:00 UTC (permalink / raw)



Hi,
	Need help with interface programming. I need to invoke a 
Square Root function in a program. So I tried interfacing to Fortran
as follows :
	procedure SOMEPROC is
	  package FORT_LIB is
	    function SQRT(X:FLOAT) return FLOAT;
	  private
	    pragma INTERFACE(FORTRAN, SQRT);
	  end FORT_LIB;
	  NUM : INTEGER;
	  NUMROOT : FLOAT;
	begin
	  GET(NUM); 
	  NUMROOT := SQRT(FLOAT(NUM));
	end SOMEPROC;
It is displaying a warning at the "pragma" line, and declaring "SQRT"
as and undefined identifier, in the line "NUMROOT := SQRT(FLOAT(NUM));".
If you have time, please take the trouble of informing me as to how to
rectify this. Also, the warning dispayed at the "pragma" line reads
approximately as : "... parameter types. SYSTEM.ADDRESS expected..."
Thanks for your patience.
--- Ramesh Mantri




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

* Re: Interface programming
  1996-08-19  0:00 Interface programming Ramesh S. Mantri
  1996-08-19  0:00 ` Paul Hussein
  1996-08-19  0:00 ` Robert Dewar
@ 1996-08-21  0:00 ` Pascal Ledru
  2 siblings, 0 replies; 5+ messages in thread
From: Pascal Ledru @ 1996-08-21  0:00 UTC (permalink / raw)



Ramesh,
You should add a use clause (use Fort_Lib) before the beginning
of you main program to gain visibility on the Fort_Lib package.
Hope this helps.




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

end of thread, other threads:[~1996-08-21  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-19  0:00 Interface programming Ramesh S. Mantri
1996-08-19  0:00 ` Paul Hussein
1996-08-19  0:00   ` Robert Dewar
1996-08-19  0:00 ` Robert Dewar
1996-08-21  0:00 ` Pascal Ledru

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