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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4cabfb8e49247533,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail From: "Lucretia" Newsgroups: comp.lang.ada Subject: Multiple shared libraries with a single spec Date: 4 Nov 2005 04:28:49 -0800 Organization: http://groups.google.com Message-ID: <1131107328.981560.222350@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: 194.74.199.42 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1131107334 11734 127.0.0.1 (4 Nov 2005 12:28:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Nov 2005 12:28:54 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 Symantec_Web_Security (3.0.1.74), 1.0 C2100-0050414028 (NetCache NetApp/5.5R5) Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=194.74.199.42; posting-account=G-J9fgwAAADgpzBiEyy5tO4f8MX5fbpw Xref: g2news1.google.com comp.lang.ada:6180 Date: 2005-11-04T04:28:49-08:00 List-Id: Hi, One of the things I need to know how to achieve is having a single specification but different bodies, to create a set of similar shared libraries. As an example, take the implementation of some maths routines (vector). I can have a version which will work on all machines i386 and FPU, then more specific versions which use SSE, MMX, etc. All of these different libs do the same thing, have the same spec, but different bodies. So I may have a directory structure like this: vector.ads i386/vector.adb i386/libvector.so sse/vector.adb sse/libvector.so mmx/vector.adb mmx/libvector.so Now, I could export a bunch of C functions and use dlopen/dlsym, etc. but this isn't the best way and it doesn't allow you to use your Ada libs the way you want to. Also it would make the types slow to use if they had to go through C constructors and interfaces (like you would a C++ shared library). I have just created a test program which creates 2 shared libs (in separate directories with separate makefiles) and then created adalib and adainclude directories in which the lib, ali and ads files were linked to. I then built the test app which linked to the files in adalib and adainclude. I could then use a symlink to change the library used. This works, but I'm not too sure if it's the correct way to do this. Has anyone else done this sort of thing with GNAT? Thanks, Luke.