Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 519029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:59:54+00:00 2026-05-13T07:59:54+00:00

I am working on a project where I need to change the behaviour of

  • 0

I am working on a project where I need to change the behaviour of the XOpenDisplay function defined in X11/Xlib.h.

I have found an example, which should do exactly what I am looking for, but when I compile it, I get the following error messages:

XOpenDisplay_interpose.c:14: Error: conflicting types for »XOpenDisplay«
/usr/include/X11/Xlib.h:1507: Error: previous declaration of »XOpenDisplay« was here

Can anyone help me with that problem? What am I missing?

My program code so far – based on the example mentioned above:

#include <stdio.h>
#include <X11/Xlib.h>
#include <dlfcn.h>

Display *XOpenDisplay(char *display_name)
{
  static Display *(*func)(char *);
  Display *ret;
  void* handle=NULL;
  handle = dlopen ("XOpenDisplay_interpose.so", RTLD_LAZY);

  if(!handle){
      fprintf(stderr, "ERROR dlopen\n");
  }

  if(!func)
    func = (Display *(*)(char *))dlsym(handle,"XOpenDisplay");

  if(display_name)
    printf("XOpenDisplay() is called with display_name=%s\n", display_name);
  else
    printf("XOpenDisplay() is called with display_name=NULL\n");

  ret = func(display_name);
  printf("  calling XOpenDisplay(NULL)\n");
  ret = func(0);
  printf("XOpenDisplay() returned %p\n", ret);

  return(ret);
}

int XCloseDisplay(Display *display_name)
{ 
  static int (*func)(Display *); 
  int ret; 
  void* handle=NULL;
  handle = dlopen ("XOpenDisplay_interpose.so", RTLD_LAZY);
  if(!handle){
   fprintf(stderr, "ERROR dlopen\n");
  }

  if(!func)
    func = (int (*)(Display *))dlsym(handle,"XCloseDisplay"); 

  ret = (int)func(display_name); 

  printf("called XCloseDisplay(%p)\n", display_name); 

  return(ret); 
}

int main()
{
}

Regards,
Andy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:59:55+00:00Added an answer on May 13, 2026 at 7:59 am

    The declaration reads like this:

    Display *XOpenDisplay(_Xconst char *display_name)

    So just adding a ‘const’ should suffice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project in which I need to change the time
I am working on a project where I need to encrypt the data which
I am working on an iPhone project, where I need to change the width
I have a project I need to be working on from two different computers,
I'm working on a spring mvc project. I need to change the style of
I'm working on a project where I need to find which functions get called
I am working with an asp.net (Dotnetnuke) project now. I need to change an
I'm working on a project that have the following need: use source ip address
im working on a web app. project and i need to change intersection region
I am working on SharePoint Branding project, where i need to change the whole

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.