From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Sep 18 19:20:12 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F07716A41F for ; Sun, 18 Sep 2005 19:20:12 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98AB143D53 for ; Sun, 18 Sep 2005 19:20:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j8IJK3nJ098305 for ; Sun, 18 Sep 2005 19:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j8IJK3f9098304; Sun, 18 Sep 2005 19:20:03 GMT (envelope-from gnats) Resent-Date: Sun, 18 Sep 2005 19:20:03 GMT Resent-Message-Id: <200509181920.j8IJK3f9098304@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Craig Rodrigues Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6EDD316A432 for ; Sun, 18 Sep 2005 19:15:23 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by mx1.FreeBSD.org (Postfix) with ESMTP id F2A0043D45 for ; Sun, 18 Sep 2005 19:15:22 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from c-66-30-115-133.hsd1.ma.comcast.net (c-66-30-112-193.hsd1.ma.comcast.net[66.30.112.193](misconfigured sender)) by comcast.net (sccrmhc12) with ESMTP id <2005091819152101200qmuofe>; Sun, 18 Sep 2005 19:15:21 +0000 Received: from c-66-30-112-193.hsd1.ma.comcast.net (localhost.127.in-addr.arpa [127.0.0.1]) by c-66-30-115-133.hsd1.ma.comcast.net (8.13.4/8.13.1) with ESMTP id j8IJFPZk038000 for ; Sun, 18 Sep 2005 15:15:25 -0400 (EDT) (envelope-from rodrigc@c-66-30-112-193.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-30-112-193.hsd1.ma.comcast.net (8.13.4/8.13.1/Submit) id j8IJFPoQ037999; Sun, 18 Sep 2005 15:15:25 -0400 (EDT) (envelope-from rodrigc) Message-Id: <200509181915.j8IJFPoQ037999@c-66-30-112-193.hsd1.ma.comcast.net> Date: Sun, 18 Sep 2005 15:15:25 -0400 (EDT) From: Craig Rodrigues To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/86304: [PATCH] graphics/jpeg does not have 'extern "C"' for C++ X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Craig Rodrigues List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2005 19:20:12 -0000 >Number: 86304 >Category: ports >Synopsis: [PATCH] graphics/jpeg does not have 'extern "C"' for C++ >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Sep 18 19:20:03 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Craig Rodrigues >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: System: FreeBSD dibbler.crodrigues.org 7.0-CURRENT FreeBSD 7.0-CURRENT #21: Sat Sep 10 19:15:12 EDT 2005 rodrigc@dibbler.crodrigues.org:/usr/obj/usr/src/sys/MYKERNEL1 i386 >Description: If jpeglib.h is included in a C++ program, the functions in libjpeg cannot be linked against, because the function prototypes are not decorated with 'extern "C"' >How-To-Repeat: If you put the following code snippet: #include #include "jpeglib.h" int main(int argc, char *argv[]) { jpeg_std_error(NULL); } in a C file (test.c), and compile with: gcc -I/usr/local/include test.c -L/usr/local/lib -ljpeg it will compile and link fine. If you rename the file to test.cpp, and compile with: g++ -I/usr/local/include test.cpp -L/usr/local/lib -ljpeg You will get a link error: : undefined reference to `jpeg_std_error(jpeg_error_mgr*)' >Fix: The fix is to re define the EXTERN macro if you are compiling with a C++ compiler. Index: patch-jmorecfg.h =================================================================== RCS file: patch-jmorecfg.h diff -N patch-jmorecfg.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patch-jmorecfg.h 18 Sep 2005 19:01:01 -0000 @@ -0,0 +1,15 @@ +--- jmorecfg.h.orig Sun Sep 18 14:53:48 2005 ++++ jmorecfg.h Sun Sep 18 14:54:27 2005 +@@ -187,8 +187,11 @@ + /* a function referenced thru EXTERNs: */ + #define GLOBAL(type) type + /* a reference to a GLOBAL function: */ ++#ifdef __cplusplus ++#define EXTERN(type) extern "C" type ++#else + #define EXTERN(type) extern type +- ++#endif + + /* This macro is used to declare a "method", that is, a function pointer. + * We want to supply prototype parameters if the compiler can cope. >Release-Note: >Audit-Trail: >Unformatted: