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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: pragma import => pointer in mapping table ? Date: Tue, 05 Nov 2013 12:56:36 +0000 Organization: A noiseless patient Spider Message-ID: References: <2d53ec9f-1ae1-4547-ac08-6fef44ab490f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="feb3f5761668d64af19c3661aa3d3ca4"; logging-data="8302"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jqXcCNxlrgf5lYej9IU95g4k009nMZno=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:it4d/WfG0VZnzT1NU0bCEm3XXY4= sha1:k/PfYZjmyycXmb1jDOboUmeHSgI= X-Original-Bytes: 2105 Xref: number.nntp.dca.giganews.com comp.lang.ada:183781 Date: 2013-11-05T12:56:36+00:00 List-Id: wkernow@gmail.com writes: > In deed, I saw that all variables X derived from a "pragma import" are > considered as pointers in mapping table whereas variables type of varX > are not access types (basic types). I expect the format of the map file depends on the version of the linker ld used on your system. But, what in the mapping table leads you to conclude that these variables are treated as pointers? If the C code contains a variable foo and the Ada code uses pragma Import to access it, then the Ada-derived object module contains an unsatisfied reference to the symbol foo (possibly _foo) and the C-derived object module contains a definition of the symbol; the linker uses the definition to satisfy the reference. So what we have is a variable at an address which is known, and when the Ada code reads the variable the corresponding machine code loads the data at that address into a register (or whatever is appropriate). You could think of this as an access via a pointer at the machine code level, but at the Ada level this is just the same as any other variable access.