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-Thread: 103376,55a8252137b5ef97 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "rien" Newsgroups: comp.lang.ada Subject: Re: Efficiently setting up large quantities of constant data Date: 16 Dec 2004 06:06:55 -0800 Organization: http://groups.google.com Message-ID: <1103206014.968630.50290@z14g2000cwz.googlegroups.com> References: NNTP-Posting-Host: 81.240.242.41 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1103206019 22536 127.0.0.1 (16 Dec 2004 14:06:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 16 Dec 2004 14:06:59 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=81.240.242.41; posting-account=JGTmxw0AAAB8_L5zFsL15G1SjsLVU94b Xref: g2news1.google.com comp.lang.ada:6994 Date: 2004-12-16T06:06:55-08:00 List-Id: Dr. Adrian Wrigley wrote: > A similar question I have is how to link in regular files and access > their contents in Ada. > > For example, suppose I have a binary file "distances.dat" containing > the (road) distances between 1000 different cities. This could be a 2MB > file computed by another application. How can I build a single executable > file containing the data and access it from the Ada code? > > I presume this needs to be done at the linker stage, but I don't > see any options to link in non-object files. The obvious alternative > of distributing the data files separately and reading them in > is slower and much less tidy than having a single self-contained binary. i did that once with a C++ application and an XML resource file. i wrote some XSL files which converted the XML resource to C++ code, and this code was linked into the application. the transformation was applied at build time using Xalan (which distributes with a pretty small executable for doing this) and triggered from the makefile. -- rien