C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 27974
Number of posts: 93458

This Forum Only
Post New Thread

Report
'needs to have dll-interface' warning Posted by Themis on 28 Jul 2005 at 10:42 AM
Hi,
I need some help with dlls. It's my first time writting dlls and I have a minor problem.

#ifdef MYPROJ_EXPORTS
#define _myprojExport __declspec(dllexport)
#else
#define _myprojExport __declspec(dllimport)
#endif

class _myprojExport MyClass
{
...
protected:
	typedef std::list<std::string> StringList;
	StringList mylist;
};


As you can see on the above code I have MyClass which is a simple class that I export. When mylist member is missing everything is compiled smoothly, however when I have mylist member variable on the class I get the following warning from my compiler (VS .NET 7.1).

warning C4251: 'MyClass::mylist' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'MyClass'
with
[
_Ty=std::string
]

How can I create a dll-interface for std::list? I don't have to export std::list the client will find its implementation in <list>. How should I declare mylist in order to get rid of these warnings?

Thanks in advance,
Themis
Report
Re: 'needs to have dll-interface' warning Posted by stober on 28 Jul 2005 at 10:56 AM
: Hi,
: I need some help with dlls. It's my first time writting dlls and I have a minor problem.
:
:
: #ifdef MYPROJ_EXPORTS
: #define _myprojExport __declspec(dllexport)
: #else
: #define _myprojExport __declspec(dllimport)
: #endif
: 
: class _myprojExport MyClass
: {
: ...
: protected:
: 	typedef std::list<std::string> StringList;
: 	StringList mylist;
: };
: 

:
: As you can see on the above code I have MyClass which is a simple class that I export. When mylist member is missing everything is compiled smoothly, however when I have mylist member variable on the class I get the following warning from my compiler (VS .NET 7.1).
:
: warning C4251: 'MyClass::mylist' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'MyClass'
: with
: [
: _Ty=std::string
: ]
:
: How can I create a dll-interface for std::list? I don't have to export std::list the client will find its implementation in <list>. How should I declare mylist in order to get rid of these warnings?
:
: Thanks in advance,
: Themis
:

templates can't be exported -- but I think you can safely ignore the error if the application program will not have access to the template object.

Report
Re: 'needs to have dll-interface' warning Posted by Themis on 29 Jul 2005 at 12:53 AM
:
: templates can't be exported -- but I think you can safely ignore the error if the application program will not have access to the template object.
:
:

Isn't there any way to get rid of because it polutes my build log and task list.

Themis
Report
Re: 'needs to have dll-interface' warning Posted by stober on 29 Jul 2005 at 3:50 AM
: :
: : templates can't be exported -- but I think you can safely ignore the error if the application program will not have access to the template object.
: :
: :
:
: Isn't there any way to get rid of because it polutes my build log and task list.
:
: Themis
:
#pragma warning(disable: xxxx) // replace xxxx with warning number






 
Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2010 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
bootstrapLabs Logo A BootstrapLabs project.