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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.190.143 with SMTP id i137mr9953457itf.43.1507723766573; Wed, 11 Oct 2017 05:09:26 -0700 (PDT) X-Received: by 10.157.85.5 with SMTP id l5mr57211oth.7.1507723766543; Wed, 11 Oct 2017 05:09:26 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder4.usenet.farm!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!l196no463825itl.0!news-out.google.com!u132ni679ita.0!nntp.google.com!k70no466945itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 11 Oct 2017 05:09:26 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:18f:900:f900:453d:87a5:de7c:1786; posting-account=AvekzAoAAABj-TclKcOWQmXwA49MFPGX NNTP-Posting-Host: 2601:18f:900:f900:453d:87a5:de7c:1786 References: <9885a3fd-8ffa-4076-ba1f-db2f8035e0dc@googlegroups.com> <93483ae9-c1ec-4cbe-92f9-49eaf41bc1f3@googlegroups.com> <5984e47c-cfe5-4d22-9907-f113f24647b9@googlegroups.com> <2bc424a1-3559-42bb-9f40-22763c21e7f2@googlegroups.com> <761a5a41-04de-4f48-aac2-f5fe167dabd5@googlegroups.com> <41f9bb00-4fa3-472e-98e4-d32e5ae4e2d6@googlegroups.com> <2f235de2-5969-4cf8-ada6-c0d886f0f9ac@googlegroups.com> <2d6225df-f847-4324-a7f0-e4544d0b5b44@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <18781206-12b4-4da8-ac8c-96d4151fa6b3@googlegroups.com> Subject: Re: The best possible way to call a function in a shared library From: John Smith Injection-Date: Wed, 11 Oct 2017 12:09:26 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:48425 Date: 2017-10-11T05:09:26-07:00 List-Id: 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;