Bug 125979 - /usr/include/X11/extensions/dpms.h cannot be used in C++ code
Summary: /usr/include/X11/extensions/dpms.h cannot be used in C++ code
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: XFree86
Version: 2
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Mike A. Harris
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-14 19:03 UTC by Kevin DeKorte
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-07-07 07:16:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Kevin DeKorte 2004-06-14 19:03:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Gecko/20040612 Firefox/0.8

Description of problem:
When using dpms.h in a C++ program. The code is compiled and linked
correctly, but when the program is ran the DPMS symbols have been
mangled by C++ and the DPMS* functions can't be located and the
program crashes. Suggest putting and #ifdef __cplusplus extern "C" in
the dpms.h header to correct this problem.

Example from xpm.h, which works correctly with C++

#ifdef __cplusplus
extern "C" {
#endif


Version-Release number of selected component (if applicable):
xorg-x11-devel-6.7.0-2

How reproducible:
Always

Steps to Reproduce:
1. create a c++ program that uses DPMSQueryExtension
2. compile and link program
3. execute program
    

Actual Results:   relocation error: 
undefined symbol: _Z18DPMSQueryExtensionP9_XDisplayPiS1_


Expected Results:  Program should execute correctly.

Additional info:

When compiling against C code the program works correctly.

In my program I did this and it solved the problem

#ifdef DPMSExtension
#include <X11/Xlib.h>
#ifndef DPMS_SERVER

#include <X11/X.h>
#include <X11/Xmd.h>

extern "C" Bool DPMSQueryExtension(Display *, int *, int *);
extern "C" Bool DPMSCapable(Display *);
extern "C" Status DPMSInfo(Display *, CARD16 *, BOOL *);
extern "C" Status DPMSEnable(Display *);
#endif
#endif

Comment 1 Mike A. Harris 2004-07-06 00:46:36 UTC
I don't want to make such a change to our X header files unless
it's been approved by upstream first, as there are risks involved
within a stable release cycle, however if you file a bug report
in the X.Org bugzilla at http://bugs.freedesktop.org and
carbon copy me on the bug report, I'll track the issue in their
bugzilla instead, and will consider backporting any changes they
make in CVS.

Thanks for the report!

Comment 2 Kevin DeKorte 2004-07-06 15:48:32 UTC
Opened bug #830 at freedesktop 

Comment 3 Mike A. Harris 2004-07-07 07:16:56 UTC
Above link points to 830 in Red Hat bugzilla.

Upstream URL link is:
http://freedesktop.org/bugzilla/show_bug.cgi?id=830

Setting bug status to "UPSTREAM" and tracking in fd.o bugzilla.

Thanks.

Comment 4 Mike A. Harris 2004-09-01 11:41:59 UTC
Status update:  The upstream bug report has not yet received any
comments from developers.  You may wish to discuss the issue with
them on xorg mailing lists, or update the upstream report with
additional comments.

Comment 5 Kevin DeKorte 2004-09-02 02:51:28 UTC
I have submitted at patch into the bugzilla report. Hopefully it will
be accepted.

Comment 6 Mike A. Harris 2006-07-21 21:44:12 UTC
Was committed to upstream CVS for a while now.  Resolving as rawhide...


Note You need to log in before you can comment on or make changes to this bug.