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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:55:35+00:00 2026-05-24T00:55:35+00:00

I use shared_ptr for an abstract class ABC. ABCImpl class is the implementation of

  • 0

I use shared_ptr for an abstract class ABC. ABCImpl class is the implementation of ABC. abc_ptr is a shared_ptr< ABC> points to an ABCImpl objects. In caller function, abc_ptr will call one of the member function (func_in_ABC) in ABC class. The compile is successful. But when I use nm or objdump, I could only see the symbol for abc_ptr. There is no symbol displayed for func_in_ABC() in the caller function.

Anyone knows why, or how an I get the output for the symbol for func_in_ABC() in the caller function?

The code is as follows:
In ABC.h:

#include <boost/shared_ptr.hpp>

class ABC
{
    public:
        virtual void func_in_ABC(const int param) = 0;
};

typedef boost::shared_ptr<ABC> ABCPtr;
ABCPtr get_ABC_ptr();

In ABCImpl.h:

#include "ABC.h"

class ABCImpl : public 
{
    public:
        ABCImpl() {}
        void func_in_ABC(const int param);
    private:
        int data;
};

In ABCImpl.cpp:

#include "ABCImpl.h"

ABCPtr get_ABC_ptr()
{
        return ABCPtr(new ABCImpl());
}

void ABCImpl::func_in_ABC(const int param)
{
    data = param;
}

In caller function D.cpp:

#include "D.h"
#include "ABC.h"

void D::call_ABC()
{
    ABCPtr abc_ptr = get_ABC_ptr();
    abc_ptr->func_in_ABC(100);
}

The output for D.o from nm:

         U _Unwind_Resume
         U get_ABC_ptr()
0000000000000000 T D::call_ABC()
0000000000000000 W boost::shared_ptr<ABC>::operator->() const
0000000000000000 r boost::shared_ptr<ABC>::operator->() const::__PRETTY_FUNCTION__
         U __assert_fail
         U __gxx_personality_v0

If I change the definition of func_in_ABC in ABC.h, the compilation for D.cpp will fail. I think it will check the definition of class ABC when compiling D.o. But why I can’t find the symbol at caller to map to the definition in ABC?

  • 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-24T00:55:35+00:00Added an answer on May 24, 2026 at 12:55 am

    Since func_in_ABC is a virtual function, you don’t actually need the symbol name to call it. You just need the offset into the virtual table for that specific virtual function.

    If you make func_in_ABC non-virtual, you should see the symbol show up in the nm output.

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

Sidebar

Related Questions

I am trying to use shared_ptr with my class but for some reason I
I am making extensive use of boost:shared_ptr in my code. In fact, most of
When using the pImpl idiom is it preferable to use a boost:shared_ptr instead of
I have to use a smart pointer and I found shared_ptr from boost looks
What is the best way to use ResolveUrl() in a Shared/static function in Asp.Net?
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
I can't use shared_ptr in my project, no boost :( So, I'm having a
So, I use boost::shared_ptr for all the various reference-counting benefits it provides -- reference
Given an abstract interface and an implementation derived from that interface, where constructors are
I want to use a temp directory that will be unique to this build.

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.