comp.lang.ada
 help / color / mirror / Atom feed
* Multiple shared libraries with a single spec
@ 2005-11-04 12:28 Lucretia
  2005-11-04 12:56 ` Niklas Holsti
  2005-11-04 14:09 ` Stephen Leake
  0 siblings, 2 replies; 27+ messages in thread
From: Lucretia @ 2005-11-04 12:28 UTC (permalink / raw)


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.




^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2005-11-08  6:31 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-04 12:28 Multiple shared libraries with a single spec Lucretia
2005-11-04 12:56 ` Niklas Holsti
2005-11-04 13:03   ` Lucretia
2005-11-04 13:22     ` Niklas Holsti
2005-11-04 15:43       ` Lucretia
2005-11-04 16:31         ` Pascal Obry
2005-11-04 17:36         ` Martin Krischik
2005-11-04 17:31       ` Martin Krischik
2005-11-04 21:55         ` Niklas Holsti
2005-11-04 13:04   ` Lucretia
2005-11-04 14:09 ` Stephen Leake
2005-11-04 15:53   ` Lucretia
2005-11-04 17:34     ` Martin Krischik
2005-11-05 10:41     ` Stephen Leake
2005-11-05 11:44       ` Lucretia
2005-11-05 14:17         ` Martin Krischik
2005-11-05 15:47           ` Stephen Leake
2005-11-05 16:00             ` Stefan Bellon
2005-11-06 11:57               ` Stephen Leake
2005-11-06 12:33                 ` Stefan Bellon
2005-11-07 17:30             ` Lucretia
2005-11-07 23:42               ` Stephen Leake
2005-11-08  6:31               ` Stefan Bellon
2005-11-05 14:12       ` Martin Krischik
2005-11-05 14:22         ` Pascal Obry
2005-11-07 14:12           ` Frank J. Lhota
2005-11-07 17:31             ` Pascal Obry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox