CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2013
    Posts
    2

    How to add a symbol of function into the file .exp

    Hello,

    If there are two projects A and B. A is created as .dll, while B is created as static library.

    project A has a class "classA"

    classA: public classB
    {
    public:
    testA();
    };

    project B has a class "classB"

    classB
    {
    public:
    testB();

    } ;

    I want to make a symbol of classB::testB() in A.exp (like ?testB@classB@@QAEXXZ), can I do it by using __declspec(dllexport)?

    Also if I make classB as a template class, can the symbol of classB::testB() be generated automatically in A.exp when building project A?

    Thanks,

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How to add a symbol of function into the file .exp

    Quote Originally Posted by jeffwang66 View Post
    A is created as .dll, while B is created as static library.
    This is where your problem is. The specific of linking with static library is that objects get extracted from the library on the stage of linking loadable module. Only those ones that required for resolving this particular module symbols. Once the dll hosts classA but never calls classB::testB inside the code, the said classB::testB body never appears in the module, and therefore, there's no symbol ?testB@classB@@QAEXXZ to export from the dll. For the process of linking the relation of inheritance really means nothing, and linking is strictly about resolving binary symbol dependencies.
    Last edited by Igor Vartanov; November 28th, 2013 at 01:52 AM.
    Best regards,
    Igor

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: How to add a symbol of function into the file .exp

    The answer is already given in your previous post about this.

    Either explicitely provide the testB member override in classA or make your executable dependant on the static lib as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured