comp.lang.ada
 help / color / mirror / Atom feed
* Loadable module in Ada.
@ 2009-12-03  9:36 Steven Shack
  2009-12-03 10:00 ` xavier grave
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Steven Shack @ 2009-12-03  9:36 UTC (permalink / raw)


I'd like to create a loadable module in an Ada program. I've searched 
around, but can't
seem to find any examples of this. Say I've got some calculation or a 
driver and I'd like to have
multiple different versions of it with the same interface. I'd like to 
be able to load and replace
these modules at runtime.

In C I'd do this with pic code, dlsym and function pointers. I can't 
seem to find the equivalent
in Ada. Can anyone help me out?

Thanks





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

* Re: Loadable module in Ada.
  2009-12-03  9:36 Loadable module in Ada Steven Shack
@ 2009-12-03 10:00 ` xavier grave
  2009-12-03 10:49   ` Steven Shack
  2009-12-03 13:40 ` Mark Lorenzen
  2009-12-03 20:06 ` Pascal Obry
  2 siblings, 1 reply; 5+ messages in thread
From: xavier grave @ 2009-12-03 10:00 UTC (permalink / raw)
  To: Steven Shack

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steven Shack a �crit :
> I'd like to create a loadable module in an Ada program. I've searched
> around, but can't
> seem to find any examples of this. Say I've got some calculation or a
> driver and I'd like to have
> multiple different versions of it with the same interface. I'd like to
> be able to load and replace
> these modules at runtime.
> 
> In C I'd do this with pic code, dlsym and function pointers. I can't
> seem to find the equivalent
> in Ada. Can anyone help me out?
> 
> Thanks
> 
> 
Hi,

I have done something that seems to fit with your need.
Here is a link where you will find a tgz file compiling/running under
Linux using dlsym. It is based on an abstract class that your plugin
should inherit of.

http://dl.free.fr/pWQwqMpVK

Be very careful about the elaboration code when you do some "with" of
other package. One on the "best" policy is to be the more restrictive
that you can with the packages you "with" (pragma Pure and so on...)

Hope it will help...
xavier


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksXjEwACgkQVIZi0A5BZF4LwQCfVGP1MA2sfQRRzvLoiCN8s1Oc
dQkAoKwEqm+RGqPc6UmhAMu2d2tqwnEG
=cLPw
-----END PGP SIGNATURE-----



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

* Re: Loadable module in Ada.
  2009-12-03 10:00 ` xavier grave
@ 2009-12-03 10:49   ` Steven Shack
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Shack @ 2009-12-03 10:49 UTC (permalink / raw)


Thank you very much. This shows me exactly how to do what I want.
I was hoping for a pure ada solution, but if I have to do dlsym I'm 
fine with that.
I already know dlsym so it's not a problem.

On 2009-12-03 02:00:44 -0800, xavier grave <xavier.grave@ipno.in2p3.fr> said:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Steven Shack a �crit :
>> I'd like to create a loadable module in an Ada program. I've searched
>> around, but can't
>> seem to find any examples of this. Say I've got some calculation or a
>> driver and I'd like to have
>> multiple different versions of it with the same interface. I'd like to
>> be able to load and replace
>> these modules at runtime.
>> 
>> In C I'd do this with pic code, dlsym and function pointers. I can't
>> seem to find the equivalent
>> in Ada. Can anyone help me out?
>> 
>> Thanks
>> 
>> 
> Hi,
> 
> I have done something that seems to fit with your need.
> Here is a link where you will find a tgz file compiling/running under
> Linux using dlsym. It is based on an abstract class that your plugin
> should inherit of.
> 
> http://dl.free.fr/pWQwqMpVK
> 
> Be very careful about the elaboration code when you do some "with" of
> other package. One on the "best" policy is to be the more restrictive
> that you can with the packages you "with" (pragma Pure and so on...)
> 
> Hope it will help...
> xavier
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAksXjEwACgkQVIZi0A5BZF4LwQCfVGP1MA2sfQRRzvLoiCN8s1Oc
> dQkAoKwEqm+RGqPc6UmhAMu2d2tqwnEG
> =cLPw
> -----END PGP SIGNATURE-----





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

* Re: Loadable module in Ada.
  2009-12-03  9:36 Loadable module in Ada Steven Shack
  2009-12-03 10:00 ` xavier grave
@ 2009-12-03 13:40 ` Mark Lorenzen
  2009-12-03 20:06 ` Pascal Obry
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Lorenzen @ 2009-12-03 13:40 UTC (permalink / raw)


On 3 Dec., 10:36, Steven Shack <stevensh...@stevenshack.com> wrote:
> I'd like to create a loadable module in an Ada program. I've searched
> around, but can't
> seem to find any examples of this. Say I've got some calculation or a
> driver and I'd like to have
> multiple different versions of it with the same interface. I'd like to
> be able to load and replace
> these modules at runtime.
>
> In C I'd do this with pic code, dlsym and function pointers. I can't
> seem to find the equivalent
> in Ada. Can anyone help me out?
>
> Thanks

I'm not sure what you mean by loadable module, but if you mean dynamic
linking at run-time, you should take a look at this very interesting
article:
http://www.adacore.com/wp-content/uploads/2005/04/dynamic_plugin_loading_with_ada.pdf

Note that you will of course still need support from the OS, so there
is no pure Ada
solution, just as there is no pure C solution (the dl* system calls
just happen to
have a C API).

- Mark



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

* Re: Loadable module in Ada.
  2009-12-03  9:36 Loadable module in Ada Steven Shack
  2009-12-03 10:00 ` xavier grave
  2009-12-03 13:40 ` Mark Lorenzen
@ 2009-12-03 20:06 ` Pascal Obry
  2 siblings, 0 replies; 5+ messages in thread
From: Pascal Obry @ 2009-12-03 20:06 UTC (permalink / raw)


Steven,

Look at the Gwiad module:

   http://code.google.com/p/gwiad/

   $ git clone git://repo.or.cz/gwiad.git

It is a framework using whatever OS services underneath based on Ada
interface.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




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

end of thread, other threads:[~2009-12-03 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03  9:36 Loadable module in Ada Steven Shack
2009-12-03 10:00 ` xavier grave
2009-12-03 10:49   ` Steven Shack
2009-12-03 13:40 ` Mark Lorenzen
2009-12-03 20:06 ` Pascal Obry

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