From owner-freebsd-bugs Sun Jan 6 5: 0:16 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3FD0337B404 for ; Sun, 6 Jan 2002 05:00:07 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g06D07T08226; Sun, 6 Jan 2002 05:00:07 -0800 (PST) (envelope-from gnats) Date: Sun, 6 Jan 2002 05:00:07 -0800 (PST) Message-Id: <200201061300.g06D07T08226@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: misc/33590: imaxabs(3), imaxdiv(3) does not work with C++ linkage Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/33590; it has been noted by GNATS. From: Bruce Evans To: Vladimir Kushnir , Cc: Subject: Re: misc/33590: imaxabs(3), imaxdiv(3) does not work with C++ linkage Date: Sun, 6 Jan 2002 23:55:14 +1100 (EST) On Sat, 5 Jan 2002, Vladimir Kushnir wrote: > >Description: > Libc functions imaxabs(3), imaxdiv(3) used in C++ programs lead to "undefined > reference" errors. > >How-To-Repeat: > Compile as C++ this code: > /* test.cc */ > #include > > main() { > intmax_t a = 1; > intmax_t b; > imaxdiv_t c; > b = imaxabs(a); > c = imaxdiv(a, b); > } > > Output: > ~> c++ -o itest test.cc > /tmp/ccplyujk.o: In function `main': > /tmp/ccplyujk.o(.text+0x21): undefined reference to `imaxabs(long long)' > /tmp/ccplyujk.o(.text+0x4e): undefined reference to `imaxdiv(long long, long long)' > > > >Fix: %%% Index: inttypes.h =================================================================== RCS file: /home/ncvs/src/include/inttypes.h,v retrieving revision 1.2 diff -u -2 -r1.2 inttypes.h --- inttypes.h 15 Nov 2001 02:05:03 -0000 1.2 +++ inttypes.h 6 Jan 2002 12:51:47 -0000 @@ -43,4 +43,5 @@ } imaxdiv_t; +__BEGIN_DECLS intmax_t imaxabs(intmax_t) __pure2; imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2; @@ -51,4 +52,5 @@ intmax_t wcstoimax(const wchar_t *, wchar_t **, int); uintmax_t wcstoumax(const wchar_t *, wchar_t **, int); +__END_DECLS #endif /* !_INTTYPES_H_ */ %%% Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message