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 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: ANN: Ada Resource Embedder for C, Ada and Go Date: Fri, 11 Jun 2021 18:19:15 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <34845325-0cb5-43ee-a03f-df95a8df1f22n@googlegroups.com> NNTP-Posting-Host: 5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62179 List-Id: On 2021-06-11 15:51, Stéphane Rivière wrote: > Hi Stephane, > >> I created a new tool to allow embedding any file in an Ada, C or Go binary. > > This is typically what I needed to improve my current AIDE v2 project > (Ada Instant Development Environment - source GNAT CE 2019 2020 2021 - > target Debian / Ubuntu with subtarget station (with GNATStudio, HAC, > libs, debug aware RTS, and goodies) or server (bare minimal). I considered embedding into relocatable libraries similar to Windows' resource, e.g. for versioning plugins etc, but then decided to use an easier and more universal method. I simply put an Ada constructing function into the library. The function is exported. The address returned by GetProcAddress or dlsym goes to Unchecked_Conversion to an access to subprogram, and here you are. The obvious advantage of this method over embedding is that the object can be tagged of any derived type, which no embedding can do. And you can add whatever further initialization or checks you might need. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de