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,e5485065ad2544d,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!k17g2000prf.googlegroups.com!not-for-mail From: Jerry Newsgroups: comp.lang.ada Subject: How do I "with" Numerics without linking BLAS, LAPACK? (and more) Date: Tue, 31 Aug 2010 01:24:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: <4ac95d41-5d82-4d77-ae4a-a02331170f1f@k17g2000prf.googlegroups.com> NNTP-Posting-Host: 75.172.184.10 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1283243067 30183 127.0.0.1 (31 Aug 2010 08:24:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 31 Aug 2010 08:24:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k17g2000prf.googlegroups.com; posting-host=75.172.184.10; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/531.21.8+(KHTML, like Gecko, Safari/528.16) OmniWeb/v622.11.0,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13865 Date: 2010-08-31T01:24:27-07:00 List-Id: This is probably going to be confusing... I have a problem with the PLplot bindings to which I can't figure out a decent solution. The Ada bindings use vectors and matrices defined like this: type Real_Vector is array (Integer range <>) of Long_Float; type Real_Matrix is array (Integer range <>, Integer range <>) of Long_Float; These can be either defined exactly like the above in the bindings proper or, in the case of Ada 2005, from the declarations from GNAT's a-nlrear.ads which are effectively exactly the same. For example, these subtypes work: (Subtyping makes distributing the declaration to the various packages easy.) with Ada.Numerics.Long_Real_Arrays; subtype Real_Vector is Ada.Numerics.Long_Real_Arrays.Real_Vector; subtype Real_Matrix is Ada.Numerics.Long_Real_Arrays.Real_Matrix; As long as the user program uses whichever of these types is specified in the bindings, the program will work OK. But there are two problems. (1) (Compiler is Ada 2005.) If the second method is used, the numerics libraries BLAS and LAPACK have to be linked. This seems like an onerous requirement simply to gain access to the vector and matrix types and nothing actually from BLAS or LAPACK. In the past, we have made this work with some cmake magic but some users have complained, some having trouble linking the libraries, and personally this approach seems like a lot of baggage. On the other hand, if the user program actually needs to use something from those libraries, or if the user simply wants to use the "official" types, the second method is the only way to go because the first declaration style will result in types that are incompatible with a-nlrear.ads. (2) (Compiler is Ada 95.) In this case, obviously, the first set of declarations will have to be used because the second set is specific to Ada 2005. So the first method guarantees 95/2005 compatibility. I can't figure out a way to make everyone happy: Maintain 95/2005 compatibility, don't require linking large libraries that aren't used, but keeping the option to link to those libraries for those who want them. I have recently changed the bindings so that the first method is used and I plan to make a note in the documentation to the effect that if the user wants to use the "official" declarations and/or wants to link the libraries, he/she should first do an ordinary PLplot build but then comment/uncomment a very small number of lines in only one file and recompile the bindings only, not the entire PLplot, thus bypassing the Ada-specific library in PLplot. For some users, will add an extra step to the already-difficult PLplot installation process. If the declarations in the second method could be accessed without requiring linking the libraries, I would consider abandoning Ada 95 compatibility, which raises the question, what fraction of new GNAT programs are still being written in Ada 95? I hope this is clear. Is there some way that can meet all of these requirements? TIA, Jerry