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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:03:21+00:00 2026-05-27T18:03:21+00:00

I have a core project which I’m building as a shared library. In one

  • 0

I have a core project which I’m building as a shared library. In one of the headers, I’ve defined a simple class shown below:

typedef pthread_mutex_t Mutex;

class CORE_API AutoLock
{
public:
    AutoLock(Mutex& m);
    ~AutoLock();

private:
    AutoLock();
    AutoLock(const AutoLock&);
    AutoLock& operator=(const AutoLock&);

    Mutex m_Mutex;
};

where CORE_API is defined as:

#ifdef CORE_DLL
#define CORE_API    __attribute__ ((dllexport))
#else
#define CORE_API    __attribute__ ((dllimport))
#endif

In the Android.mk for core, I’ve defined CORE_DLL under LOCAL_CFLAGS. However, when building, I get the warning:

warning: 'dllimporot' attribute directive ignored

When ndk-build gets to the other project where I want to use the AutoLock class, I get the error:

error: 'AutoLock::AutoLock()' is private
error: within this context

Why would the compiler ignore the dllexport attribute? I would hope that once that’s fixed, my other project should build and be able to use the AutoLock class without any problems.

  • 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-27T18:03:21+00:00Added an answer on May 27, 2026 at 6:03 pm

    Shared libraries are created differently on Android (Linux) than with Windows.
    In Windows you have the special dllimport and dllexport directives but not on Android (Linux).

    When using your shared library, you should just compile with -lYourLibraryName

    This might help you: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html

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

Sidebar

Related Questions

I have 2 projects. One project is a core and contains the GUI which
I have a pre-existing project to which I've added Core Data models. I added
I have an experimental NServiceBus project running which has: MyProject.Core - message publisher using
In my project, I have two Core Data entities. One is the grouping (can
I have an upcoming project in which a core requirement will be to mutate
I have 2 namespaces: Project.Core; Tests.Project.Core; In Project.Core there is a Class named Text
I'm starting a new project which in simple terms will have a UI layer
I have a project which has a makefile: # a simple makefile # Uncomment,
I have a two projects, AI and Core , which used to hold a
I have a CORE class that pertains only to my specific site, ie, it

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.