comp.lang.ada
 help / color / mirror / Atom feed
* DLL dynamic load
@ 2002-09-05  0:15 Fabien Garcia
  2002-09-05 13:48 ` Ted Dennison
  0 siblings, 1 reply; 3+ messages in thread
From: Fabien Garcia @ 2002-09-05  0:15 UTC (permalink / raw)


Hello,

I'm using gnat 3.13p on windows XP and I'm trying to find where the 
dynamic load of a DLL is explained (if it is at all possible).
Here are my questions :
	- Is it possible to load a DLL at a specific moment at runtime
(The point being that I want to load a different dll implementing the 
same API depending on the task my application is set to, like for 
exemple in plugins-enabled applications)
         - If so, can someone send me a small example program doing so ?
         - If not, what is the use of dynamic library except for 
compilation/linking benefits

Thanks a lot for your expected answer :)

Fabien




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

* Re: DLL dynamic load
  2002-09-05  0:15 DLL dynamic load Fabien Garcia
@ 2002-09-05 13:48 ` Ted Dennison
  2002-09-06 13:05   ` Fabien Garcia
  0 siblings, 1 reply; 3+ messages in thread
From: Ted Dennison @ 2002-09-05 13:48 UTC (permalink / raw)


Fabien Garcia <Fabien.garcia6@nospam.wanadoo.fr> wrote in message news:<3D76A22B.5080803@nospam.wanadoo.fr>...
> I'm using gnat 3.13p on windows XP and I'm trying to find where the 
> dynamic load of a DLL is explained (if it is at all possible).
> Here are my questions :
> 	- Is it possible to load a DLL at a specific moment at runtime
> (The point being that I want to load a different dll implementing the 
> same API depending on the task my application is set to, like for 
> exemple in plugins-enabled applications)
>          - If so, can someone send me a small example program doing so ?
>          - If not, what is the use of dynamic library except for 
> compilation/linking benefits

Yes, you can do that (its called "explicit linking"). Its just a
matter of calling LoadLibrary (or LoadLibraryEx) when you want it
loaded (and call FreeLibrary if you want it unloaded before your
program terminates). If you do it this way, you also have to call
GetModuleHandle to get pointers to all the routines in the DLL which
you want to use.

This is standard Win32 programming, and as such the best place to look
for examples and documentation are the usual Win32 sources (MSDN,
Win32 programming books, etc.)

However, for what you seem to be wanting to do, I think COM might be a
better approach. I'd suggest you go look at
http://www.adapower.com/gnatcom/index.html for Gnat support for COM
and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/msdn_dcomarch.asp
for more information on COM (DCOM) itself.



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

* Re: DLL dynamic load
  2002-09-05 13:48 ` Ted Dennison
@ 2002-09-06 13:05   ` Fabien Garcia
  0 siblings, 0 replies; 3+ messages in thread
From: Fabien Garcia @ 2002-09-06 13:05 UTC (permalink / raw)


Thanks a lot for your answers, I managed to make this work though the 
win32 calls. I'll look at COM later.

Fabien




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

end of thread, other threads:[~2002-09-06 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-05  0:15 DLL dynamic load Fabien Garcia
2002-09-05 13:48 ` Ted Dennison
2002-09-06 13:05   ` Fabien Garcia

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