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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e2d31bd26aeb2e2f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-05 06:48:37 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: DLL dynamic load Date: 5 Sep 2002 06:48:36 -0700 Organization: http://groups.google.com/ Message-ID: <4519e058.0209050548.22ad62ce@posting.google.com> References: <3D76A22B.5080803@nospam.wanadoo.fr> NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1031233716 25922 127.0.0.1 (5 Sep 2002 13:48:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 5 Sep 2002 13:48:36 GMT Xref: archiver1.google.com comp.lang.ada:28751 Date: 2002-09-05T13:48:36+00:00 List-Id: Fabien Garcia 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.