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 8389967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:51:51+00:00 2026-06-09T18:51:51+00:00

We have a big, old C++ application with a lot of legacy code and

  • 0

We have a big, old C++ application with a lot of legacy code and a few external libraries written in C. These libraries are very rarely updated – only if we find a bug and the vendor supplies a patch. This happened last week with one library, and upon integrating the new version we found out that if we don’t modify the library locally (which we apparently did with the last version) our build breaks with this error message:

non-local function ‘static E* MyCls::myFct(<anonymous struct>*)’ uses anonymous type

This is due to the library declaring a number of handle types like this:

#define _Opaque struct {unsigned long x;} *

typedef _Opaque    Handle;
typedef _Opaque    Request;

which we use on our side in some classes’ function signatures:

class MyCls {
public:
    static void* myFct(Handle handle);
    ...
}

This produces the error above because the compiler can’t create a proper name-mangled name for the function(s) as the _Opaque struct has no name.

Our current workaround for this is to patch the library header file, explicitly giving the struct a name:

//#define _Opaque struct {unsigned long x;} * //Replaced by typedef below!
typedef struct __Opaque {unsigned long x;} * _Opaque;

This is obviously bad because we don’t want to touch the library if possible. Another even worse option would be to convert the types to void* in all function signatures and cast them back to their respective types. And there’s the worst option to rewrite every affected function in pure C…

So, my question is: Is there any better option than patching the library? Is there an easy solution I am overlooking? What would be the best way to solve this?

  • 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-06-09T18:51:53+00:00Added an answer on June 9, 2026 at 6:51 pm

    You can accomplish this with a minimal change to the #define line, exploiting the rule in 7.1.3:8 that the first typedef-name declared by the declaration to be
    that class type (or enum type) is used to denote the class type (or enum type) for linkage purposes only
    :

    #define MAKE_DUMMY2(line) dummy_ ## line
    #define MAKE_DUMMY(line) MAKE_DUMMY2(line)
    #define _Opaque struct {unsigned long x;} MAKE_DUMMY(__LINE__), *
    

    This gives Handle and Request etc. minimal linkage.

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

Sidebar

Related Questions

Currently I'm working with a big, old and extremely poorly written ASP.NET 1.1 application
I'm developing an application for android, and i have a big old GridView that's
I have an existing J2EE project which is very big and old. Therefore, my
I have a big application as an enterprise scale, there are lots of developers
I build some dlls to be used in a big application, and have a
I have a SQL Server that holds a lot of data. An application, running
I have an old (around 5 years) enterprise application that I manage. Recently we
I've an old big application in php that uses XML (DOMDocument). The application works
The Scenario I have an application where we took the good old query string
We have a pretty big application with lots of objects being passed between flex

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.