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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Any good package for mathematical function in Ada? Date: Mon, 1 Jun 2020 12:19:14 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <45af26dc-c35f-4a01-8115-7b30021cc064@googlegroups.com> <835a8c6a-54a8-4157-bcf1-e889d18b1b46@googlegroups.com> NNTP-Posting-Host: 2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58917 Date: 2020-06-01T12:19:14+02:00 List-Id: On 01/06/2020 10:24, reinert wrote: > Anybody having a simple (complete - runable) code example using GSL from Ada? Assuming Windows. Install MSYS2 if you did not already. [64-bit, GNAT GPL is not available for 32-bit anymore.] Install GSL mingw-w64-x86_64-gsl under MSYS. Now, assuming that MSYS2 is under C:\MSYS64\MinGW, here you go: ---gsl.gpr-------------- project GSL is for Main use ("test.adb"); package Linker is for Default_Switches ("ada") use ("-L/c/msys64/mingw/lib", "-lgsl"); end Linker; end GSL; ---gsl.ads------------- with Interfaces.C; use Interfaces.C; package GSL is function Bessel_J0 (X : double) return double; private pragma Import (C, Bessel_J0, "gsl_sf_bessel_J0"); end GSL; ---test.adb------------> with Ada.Text_IO; use Ada.Text_IO; with GSL; use GSL; with Interfaces.C; use Interfaces.C; procedure Test is begin Put_Line ("J0(1)=" & double'Image (Bessel_J0 (1.0))); end Test; ----------------------- The test produces: J0(1)= 7.65197686557967E-01 -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de