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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:36:45+00:00 2026-05-13T14:36:45+00:00

I have a defined a custom error domain that I want to publish in

  • 0

I have a defined a custom error domain that I want to publish in a protocol. The domain is defined in the implementation file like this:

//in the .m file
static void *MyErrorDomain = (void *)@"MyErrorDomain";

The .h file implements a protocol, and I would like to publish MyErrorDomain there as well. I can’t, however, figure out the correct form. The one that gives the fewest errors is:

// in the protocol    
static extern void * TBPluginErrorDomain;

The Xcode error is: “Multiple storage classes in declaration specifiers”.

I thought that the static void construction turns MyErrorDomain into a kind of function, but “static extern void TBPluginErrorDomain();” only incremented the number of errors. In short, I’m wandering in a morass of ignorance and all guidance will be greatly appreciated.

  • 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-13T14:36:45+00:00Added an answer on May 13, 2026 at 2:36 pm

    At the top-level, static means “not directly accessible (without a pointer) outside this file” (file scope). extern means “defined in some other object file”. static extern does not really make any sense. It is like asking for access to a private member from another class. You do not want to use static here.

    Just make a normal definition in your .m:

    void *MyErrorDomain = @"MyErrorDomain";
    

    And make an extern declaration in your .h:

    extern void *MyErrorDomain;
    

    The be sure to link in the .o from the .m whenever you link together something that uses the variable (after including the .h file). In Xcode, in the Targets tab of the Get Info window for the .m file, be sure to check each target that uses the variable (maybe slightly different in newer versions, mine is old!).

    You can probably add in const (const … and extern const …), but NSString instances are immutable, so it is not totally necessary. You might make it into a const pointer though, so the pointer can not be directly changed at runtime (without casting away the constness). Together you have const void * const MyErrorDomain in the definition. Just prefix it with extern in the declaration.

    Also, depending on your purposes, you might consider using a NSString * instead of void *.

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

Sidebar

Related Questions

I've defined a custom error type that I want to use with the Error
I have defined a custom IPrincipal and custom IIdentity based on a website that
I have defined a custom file type with these lines: syn region SubSubtitle start=+=+
I have custom attribute defined like so: [AttributeUsage(AttributeTargets.Field)] public class EnumDisplayAttribute : Attribute {
In my ASP.NET web application, I have defined custom error pages in my web.config
In my asp.net web site I have custom error pages defined as following in
I have defined a custom error but if I test if custom error gets
I have a custom class defined in Actionscript and I want to make an
I have custom error handling defined for my application and it all works wonderfully
I have defined a custom assert macro. This works fine for all other comparisons.

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.