From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!RKN7TKnHC01q0gdg6EhkbQ.user.46.165.242.75.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Help: Ada in NetBSD Date: Sun, 29 Aug 2021 19:25:05 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <16242b6e-cfb6-4fb1-8f7f-566469de446an@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: gioia.aioe.org; logging-data="31700"; posting-host="RKN7TKnHC01q0gdg6EhkbQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cancel-Lock: sha1:/7O40wzVKt1p9XS3LiawhpYXrzs= X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:62576 List-Id: Fernando Oleo Blanco writes: >> On NetBSD there are several symbols that are replaced by the virtue >> of including a C header. >> If you include correctly the C header, the correct symbol is used >> and you don't get the linker warning. > > That is what I did by adding the indicated header files to the NetBSD > section of the init.c file. No other systems have them there (or > anywhere in some cases). I expected that to fix the issue, but it did not. The problem can't be fixed by including C headers, because ... >> For gettimeofday the symbol is replaced by __gettimeofday50. >> These symbols are marked with __RENAME(XXX) macros in the C headers. The C header is (I got this from the net, so beware) int gettimeofday(struct timeval * __restrict, void *__restrict) __RENAME(__gettimeofday50); so when you say, in Ada, function gettimeofday (tv : not null access struct_timeval; tz : struct_timezone_ptr) return Integer; pragma Import (C, gettimeofday, "gettimeofday"); the linker looks for a symbol gettimeofday (or maybe _gettimeofday) and gives you the warning that you report. Since it's just a warning, it may actually work - for the moment, anyway. The Ada needs to change to function gettimeofday (tv : not null access struct_timeval; tz : struct_timezone_ptr) return Integer; pragma Import (C, gettimeofday, "gettimeofday50"); (or maybe "_gettimeofday50", or even "__gettimeofday50" - nm will be your friend).