comp.lang.ada
 help / color / mirror / Atom feed
From: John Smith <yoursurrogategod@gmail.com>
Subject: Re: The best possible way to call a function in a shared library
Date: Wed, 11 Oct 2017 05:09:26 -0700 (PDT)
Date: 2017-10-11T05:09:26-07:00	[thread overview]
Message-ID: <18781206-12b4-4da8-ac8c-96d4151fa6b3@googlegroups.com> (raw)
In-Reply-To: <orkg0u$13o4$1@gioia.aioe.org>

On Wednesday, October 11, 2017 at 3:08:16 AM UTC-4, Dmitry A. Kazakov wrote:
> On 11/10/2017 02:38, John Smith wrote:
> 
> > I'm assuming that it has something to do with gnatls (sorry, I'm not
> > sure how this works on Windows.) This did work shortly after I got the
> > static libraries to work (they still do, the shared libraries do not
> > work though) and I'm trying to figure out what I screwed up.
> 
> Static libraries are linked statically. DLLs are linked at run-time by 
> the system loader. There are rules where the loader looks for the DLLs.
> 
> Under Windows they are:
> 
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
> 
> P.S. The simplest way is to put the executable in the same directory 
> with the DLL.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

I've had the binary that uses the *.DLL having it include the library via the *.gpr file and that used to work.  When it comes to finding the DLL, that should be handled by the related GPRs.

This compiles the *.exe:

with "../../../use_project.gpr";

project Main_Dynamic is
  for Source_Dirs use (".");
  for Object_Dir use ".";
  for Main use ("main_dynamic.adb");

  package Builder is
  end Builder;

  package Compiler is
    for Switches("Ada") use ("-g", "-gnatwa");
  end Compiler;

  package Binder is
  end Binder;

  package Linker is
  end Linker;
end Main_Dynamic;




And this is what points to the compiled DLL (but doesn't compile it):

library project Use_Project is
  for Externally_Built use "true";
  for Source_Dirs use ("src");
  for Library_Dir use "bin/debug";
  for Library_Name use "simpleLibs";
  for Library_Kind use "dynamic";
  for Library_ALI_Dir use "ali/debug";
end Use_Project;

  reply	other threads:[~2017-10-11 12:09 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-01 21:06 The best possible way to call a function in a shared library John Smith
2017-10-01 23:51 ` John Smith
2017-10-02  7:15   ` Dmitry A. Kazakov
2017-10-02 11:12     ` John Smith
2017-10-02 11:32       ` Dmitry A. Kazakov
2017-10-02 22:44         ` John Smith
2017-10-03  7:14           ` Dmitry A. Kazakov
2017-10-03 11:32             ` John Smith
2017-10-03 13:43               ` Dmitry A. Kazakov
2017-10-03 23:28                 ` John Smith
2017-10-04  2:10                   ` John Smith
2017-10-04  8:10                     ` Dmitry A. Kazakov
2017-10-04 11:23                       ` John Smith
2017-10-04 11:48                         ` Dmitry A. Kazakov
2017-10-04 11:54                           ` John Smith
2017-10-04 11:59                             ` Dmitry A. Kazakov
2017-10-04 12:04                               ` John Smith
2017-10-04 12:47                                 ` Dmitry A. Kazakov
2017-10-04 15:03                   ` Simon Wright
2017-10-04 23:24                     ` John Smith
2017-10-05 23:55                       ` John Smith
2017-10-06  2:21                         ` John Smith
2017-10-06  6:46                           ` Dmitry A. Kazakov
2017-10-06 11:30                             ` John Smith
2017-10-06 13:26                               ` Dmitry A. Kazakov
2017-10-06 18:57                                 ` Simon Wright
2017-10-06 19:18                                   ` Dmitry A. Kazakov
2017-10-07  2:47                                 ` John Smith
2017-10-07  3:57                                 ` John Smith
2017-10-07  8:25                                   ` Dmitry A. Kazakov
2017-10-07 11:52                                     ` Simon Wright
2017-10-07 12:57                                     ` John Smith
2017-10-07 13:19                                       ` Dmitry A. Kazakov
2017-10-07 13:28                                         ` John Smith
2017-10-10  3:39                                         ` John Smith
2017-10-10 13:15                                           ` Dmitry A. Kazakov
2017-10-11  0:38                                             ` John Smith
2017-10-11  1:18                                               ` Anh Vo
2017-10-11  1:22                                                 ` John Smith
2017-10-11  1:40                                                   ` Anh Vo
2017-10-11  7:08                                               ` Dmitry A. Kazakov
2017-10-11 12:09                                                 ` John Smith [this message]
2017-10-11 13:43                                                   ` Dmitry A. Kazakov
2017-10-11 22:25                                                   ` Randy Brukardt
2017-10-11 22:57                                                     ` John Smith
2017-10-13  0:38                                                       ` John Smith
2017-11-06  6:25                                                       ` Robert Eachus
2017-10-03 14:22               ` Dennis Lee Bieber
2017-10-02  7:30 ` Dmitry A. Kazakov
2017-10-11 14:31   ` John Smith
2017-10-11 15:50     ` John Smith
replies disabled

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