comp.lang.ada
 help / color / mirror / Atom feed
From: "kat-Zygfryd" <6667@wp.pl>
Subject: DLLs / shared objects
Date: Sat, 4 Oct 2003 01:47:43 +0200
Date: 2003-10-03T23:47:33+00:00	[thread overview]
Message-ID: <bll1ql$ehp$1@news.onet.pl> (raw)

I'd like to have a plugin system in my Ada program -
loading functions/procedures from dll's/so's unknown at compiletime,
but found by the app at runtime. All information I found concerned
only Windows DLLs and involved statically linking parts of the dynamic libs,
which is unacceptable.
Is there any way in Ada to do so? (GNAT 3.14p, x86 Windows/Linux)

kZ

A schematical example of what I mean:

<DLL>
type PluginFunc is access function (someparam) return someresult;
type Callback is access procedure (FuncName: String; FuncCode: PluginFunc);
procedure Init(proc: Callback) is
begin
  proc("SomePluginFunc",MyFunc'Access);
end Init;
function MyFunc(...

<Program>
type PluginFunc is access function (someparam) return someresult;
type Callback is access procedure (FuncName: String; FuncCode: PluginFunc);
procedure SetFunc(FuncName: String; FuncCode: PluginFunc) is
begin
    Add(FuncHashTable,FuncName,FuncCode);
end SetFunc;
...
loop
  SomeDLL := FindDLL(...);
  exit when ...;
  InitProc := ObtainInitProc(SomeDLL); <--- ???
  InitProc(SetFunc);
end loop;





             reply	other threads:[~2003-10-03 23:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-03 23:47 kat-Zygfryd [this message]
2003-10-04  7:58 ` DLLs / shared objects Patrice Freydiere
     [not found] ` <m2r81tn9mv.fsf@jvdsys.demon.nl>
2003-10-04 10:10   ` chris
2003-10-04 11:03 ` chris
replies disabled

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