VC6 DLL export of a class - warning C4251

Hello Experts,

I am creating a DLL.  In this DLL, i have a class named 'Model' that gets exported, and another class 'Transform' used in the class 'Model'. I do not want to export this class 'Transform' as it will not be used outside the DLL, but i got warnings like this:

warning C4251: 'tran' : class 'Transform' needs to have dll-interface to be used by clients of class Model'
Any one please tell me can i just ignore those warnings, or i have to export the class 'Transform'?

Regards,
Alison
lzha022Asked:
Who is Participating?
 
abancroftConnect With a Mentor Commented:
Your best best is to export Transform from the DLL. If that really is not accepatable, you could write a small test app that uses Model, build it & run it.
0
 
abancroftCommented:
Is Transform referenced in the declaration of class Model? i.e. in the Model header file.
0
 
lzha022Author Commented:
Yes, in deader declared as Transform tran;
I think that is the reason of the warnings.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
abancroftCommented:
It is. Even if it's private or protected.

To completely hide it, you'd need to use the pimpl idiom: http://c2.com/cgi/wiki?PimplIdiom
0
 
lzha022Author Commented:
My project is too big, and there are more same warnings for other classes too. I can not afford to change all of them. All i want to know is that will this affect the functionality of my DLL if i just ignore those warnings.

0
 
abancroftCommented:
It depends - is Transform declared entirely inline, or are some parts of it in a CPP file in your DLL? External users of class Model may need to call some transform methods indirectly. e.g. constructor, assignment operator etc. It really depends on how Transform is declared and how it is used in Model.
0
 
lzha022Author Commented:
is Transform declared entirely inline, or are some parts of it in a CPP file in your DLL? - I am not quite sure what you mean here.
protected:
Transform tran
0
 
abancroftCommented:
Is the Transform class all inline? i.e. is all it's code in it's header file.
0
 
lzha022Author Commented:
...Continued:
class Model or some other classes will call tran.methods
So it is true that when use call Model it will inderectly call the Constructor of Transform and other mothods - but i think those all happen within the DLL.
0
 
lzha022Author Commented:
Is the Transform class all inline? No, it is a complete class
0
 
lzha022Author Commented:
Thanks, I will try it
0
 
lzha022Author Commented:
Looks like it works
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.