-
November 27th, 2013, 05:38 PM
#1
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,
-
November 28th, 2013, 01:33 AM
#2
Re: How to add a symbol of function into the file .exp
Originally Posted by jeffwang66
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
-
November 28th, 2013, 07:31 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|