Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

template STL and DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
whatazor - 10 Oct 2007 10:55 GMT
Hi all,
I've a std::set defined inside a class that must be exported/imported.

I've use this macro:

#define EXPORT_STL_SET( dllmacro, settype ) \
 template class dllmacro std::allocator< settype >; \
 template struct dllmacro std::less< settype >; \
 template class dllmacro std::allocator< \
   std::_Tree_nod<std::_Tset_traits<settype,std::less<settype>, \
   std::allocator<settype>,false> > >; \
 template class dllmacro std::allocator<  \
   std::_Tree_ptr<std::_Tset_traits<settype,std::less<settype>, \
   std::allocator<settype>,false> > >; \
 template class dllmacro std::_Tree_ptr< \
   std::_Tset_traits<settype,std::less<settype>, \
   std::allocator<settype>,false> >; \
 template class dllmacro std::_Tree_nod< \
   std::_Tset_traits<settype,std::less<settype>, \
   std::allocator<settype>,false> >; \
 template class dllmacro std::_Tree_val< \
   std::_Tset_traits<settype,std::less<settype>, \
   std::allocator<settype>,false> >; \
 template class dllmacro std::set< settype, std::less< settype >, \
   std::allocator< settype > >;

find here:
http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html

but it gives me other 4251 warning like these:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
\xtree(65) : warning C4251: 'std::_Tree_nod<_Traits>::_Alnod' : class
'std::allocator<_Ty>' needs to have dll-interface to be used by
clients of class 'std::_Tree_nod<_Traits>'
       with
       [

_Traits=std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>,false>
       ]
       and
       [

_Ty=std::_Tree_nod<std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>,false>>::_Node
       ]
       and
       [

_Traits=std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>,false>
       ]
       c:\cvsMAF\DLLTEST_openMAF22_ITK\IO\testClass.h(160) : see
reference to class template instantiation 'std::_Tree_ptr<_Traits>'
being compiled
       with
       [

_Traits=std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>,false>
       ]

I use Visual Studio .NET 2003. How can get rid of all these warning?
Sheng Jiang[MVP] - 10 Oct 2007 18:42 GMT
Expoer accessor methods instead of the template class. See Knowledge Base
article 172396
PRB: Access Violation When Accessing STL Object in DLL

Signature

Sheng Jiang
Microsoft MVP in VC++

> Hi all,
> I've a std::set defined inside a class that must be exported/imported.
[quoted text clipped - 33 lines]
>         with
>         [

_Traits=std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>
,false>
>         ]
>         and
>         [

_Ty=std::_Tree_nod<std::_Tset_traits<myClass,std::less<myClass>,std::allocat
or<myClass>,false>>::_Node
>         ]
>         and
>         [

_Traits=std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>
,false>
>         ]
>         c:\cvsMAF\DLLTEST_openMAF22_ITK\IO\testClass.h(160) : see
> reference to class template instantiation 'std::_Tree_ptr<_Traits>'
> being compiled
>         with
>         [

_Traits=std::_Tset_traits<myClass,std::less<myClass>,std::allocator<myClass>
,false>
>         ]
>
> I use Visual Studio .NET 2003. How can get rid of all these warning?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.