From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a05:6214:1844:: with SMTP id d4mr2140599qvy.56.1618480066060; Thu, 15 Apr 2021 02:47:46 -0700 (PDT) X-Received: by 2002:a25:6c86:: with SMTP id h128mr3298262ybc.161.1618480065890; Thu, 15 Apr 2021 02:47:45 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 15 Apr 2021 02:47:45 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=2804:14c:4c1:b99c:3626:d31a:1f9b:e902; posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ NNTP-Posting-Host: 2804:14c:4c1:b99c:3626:d31a:1f9b:e902 References: <865ff80f-0954-472b-b460-75bd63dfbecbn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: ? How get/use a 'type' from a Ada shared library loaded at run time (plugin) ? From: Daniel Norte Moraes Injection-Date: Thu, 15 Apr 2021 09:47:46 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61792 List-Id: Em quinta-feira, 15 de abril de 2021 =C3=A0s 06:28:29 UTC-3, Dmitry A. Kaza= kov escreveu: > On 2021-04-15 10:48, Daniel Norte Moraes wrote:=20 >=20 > > How use Ada 'type(s)' from an library loaded at run time (dlopen &Cia)?= are they possible? > Like any other type.=20 >=20 > You should not forget to initialize the library though. The library=20 > project should normally have=20 >=20 > for Library_Auto_Init use "false";=20 >=20 > because otherwise it would likely deadlock under Windows [if you wish to= =20 > make your project portable]. Under Linux I am not sure if it deadlocks,= =20 > never tested for that. > > My main need is to declare variables from these types or and make=20 > > dispatching calls based in these types. > You cannot declare variables of types declared in a dynamically loaded=20 > library for the obvious reason that you cannot dynamically refer to a=20 > package from the library.=20 >=20 > But you can dispatch on a class-wide object which specific type is=20 > declared in a dynamically loaded library.=20 >=20 > For example you can call a dynamically loaded constructing function that= =20 > returns T'Class where T is declared outside the library and then=20 > dispatch to an overridden primitive operation of S derived from T inside= =20 > the library.=20 >=20 > To my understanding library initialization expands dispatching tables=20 > with all tagged types declared in the library.=20 >=20 > P.S. What happens on finalization is an intriguing question. I would=20 > rather never attempt to unload an Ada library...=20 >=20 > --=20 > Regards,=20 > Dmitry A. Kazakov=20 > http://www.dmitry-kazakov.de Thanks! Best Whishes, Dani.