From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5ab34cdc1859e33f X-Google-Attributes: gid103376,public From: David C. Hoos, Sr. Subject: Re: Problem with pragmas Date: 1999/06/30 Message-ID: <7ldqh0$nbq$1@nnrp1.deja.com>#1/1 X-Deja-AN: 495692400 References: X-Http-Proxy: 1.1 x25.deja.com:80 (Squid/1.1.22) for client 205.149.60.17 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Wed Jun 30 19:18:04 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT) Date: 1999-06-30T00:00:00+00:00 List-Id: In article , robsch@robkaos.ruhr.de (Robert Schien) wrote: > I need to access the erf (Gaussian error function) from the C-Math- Library. > But the following program does not work correctly: > What you missed was that the type of the parameters is not C_Float, but Double. The following version of your program works correctly, and eliminates the need for the -largs on the command line, as well. with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Text_IO; use Ada.Text_IO; with Interfaces.C; use Interfaces.C; procedure Pragtest is pragma Linker_Options ("-lm"); Y: Float; C_Y: Double; -- Accessing Gaussian error function function Erf (X: in Double) return Double; pragma Import(C,Erf); begin Y:=0.3; C_Y:=Double(Y); C_Y:=Erf(C_Y); Y:=Float(C_Y); Put(Y); end Pragtest; Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.