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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c1bdceb867926fdb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Interfacing Ada with C Date: Sat, 31 Jul 2010 22:02:06 +0100 Organization: A noiseless patient Spider Message-ID: References: <317a22bc-3fff-4036-8945-8a61befab2eb@c10g2000yqi.googlegroups.com> <0b4752f2-411e-4f82-835a-8a46adaf2ff4@5g2000yqz.googlegroups.com> <926bde60-e228-4394-8fca-bcaee1eb72f0@s9g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 31 Jul 2010 21:02:08 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="KCXegvZb5vh43D+f3BR6Ew"; logging-data="15630"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ospXC/y0ew4wyVjjEi5aAG2/Fgjg+Rzc=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:r+RxwPyP0NOGjTu4C+w+mK0fkGk= sha1:vNbSGTn97HfuMISnc0DJ0JdPeXI= Xref: g2news1.google.com comp.lang.ada:12758 Date: 2010-07-31T22:02:06+01:00 List-Id: Ada novice writes: > Success here with the testing! Thanks for all your very kind help > Simon. First, I would like to draw your attention on 1 point. At > first, I was copying your raw files into AdaGIDE in order to save > them. Then running gnatmake -p -P test_extensions did produce a lots > of error messages: incorrect line terminator. I remember getting this > message before and what I did was to save the files in GPS and the > error messages disappear. I think in AdaGIDE pasting raw text can > cause some incompatibility due to the file system used. This is why I > guess I got this error: incorrect line terminator. I can't explain > this but I don't have it in GPS. Was this perhaps with the ada-numerics* files? there may be some -gnatpg problem with inconsistent line terminators, I guess GPS is clever enough to know that it's going to be anuisance and fix it. > After successfully saving all your raw files within GPS, I ran > gnatmake -p -P test_extensions without any warnings/error messages and > the following were created: > > A.) A lib folder is created at the same hierarchy level as src and > test. It has 2 files: > 1.libada_math.dll > 2.ada-numerics-generic_complex_arrays-extensions.ali > > B.) In the src folder a .build folder is created with 2 files: > 1. ada-numerics-generic_complex_arrays-extensions.ali > 2. ada-numerics-generic_complex_arrays-extensions.o > > C.) In the test folder a .build folder is created with 6 files: > 1. b~test_extensions.adb > 2. b~test_extensions.ads > 3. b~test_extensions.ali > 4. b~test_extensions.o > 5. test_extensions.ali > 6. test_extensions.o > > Then I was able to build using Build main: test_extensions.adb > successfully. This looks as expected. NB that's a sort of half-baked library; to make a proper dll * include files it needs to be a 'stand-alone library' in GNAT terms. From the user's point of view it Just Works (I did have a problem on a Debian machine with GCC 4.3.2, didn't automatically find the shared library). Anyway, if it works for you on windows don't worry about it! > Now for the outputs I get: > > 2.00000E+00 4.00000E+00 > 2.00000E+00 -4.00000E+00 > 9.99999E-01 1.10569E-07 > > -6.00000E+00 > -4.00000E+00 > -2.00000E+00 > -1.21279E-07 > 2.00000E+00 > 4.00000E+00 > 6.00000E+00 > > 6.00000E+00 0.00000E+00 > 4.00000E+00 0.00000E+00 > -6.00000E+00 0.00000E+00 > 2.00000E+00 0.00000E+00 > -3.17504E-07 0.00000E+00 > -4.00000E+00 0.00000E+00 > -2.00000E+00 0.00000E+00 > > The second set of results are for the Test16 which are ok. What about > the third set of results? What are these? The second set are with the package that comes with the compiler, that takes a symmetric complex matrix (which this is - needs to be complex to check the new code) and outputs a real eigenvalue vector. The third set are with the new package, that takes a general complex matrix and outputs a complex eigenvalue vector. > I didn't add -gnatpg for the compiler switch. I had these: -gnatqQ - > gnat05 and I can compile fine and output the results. Is the -gnatpg a > necessity? Yes *but only in the src/ directory*, which is why it's in ada_math_build.gpr & not in test_extensions.gpr. This is part of a clean compile... gcc -c -g -fPIC -gnatpg -gnatqQ -gnat05 -I- -gnatA /Users/simon/gnat-math-extn/src/ada-numerics-generic_complex_arrays-extensions.adb gcc -c -g -gnatqQ -gnat05 -I- -gnatA /Users/simon/gnat-math-extn/test/test_extensions.adb and the first line, for the library, has the additional flags -fPIC (because, on this architecture, you need position-independent code for a shared library) and -gnatpg (from ada_math_build.gpr, as discussed). > Thanks very much for helping me with the compilation. Now it's good > that some more testing is done on different cases. Do you plan to add > the output for eigenvectors also? Seemed like a plan! Also real non-symmetric, I think. I found the LAPACK test suite described here - http://www.netlib.org/lapack/lawns/lawn41.ps - could be useful though it could also be a pain to translate.