Reg. Access Violation When Accessing STL Object between a DLL and
From: Muthu Nivas (MuthuNivas_at_discussions.microsoft.com)
Date: 02/28/05
- Next message: Doug Harrison [MVP]: "Re: Reg. Access Violation When Accessing STL Object between a DLL and"
- Previous message: Doug Harrison [MVP]: "Re: std::map: clear throws an exception"
- Next in thread: Doug Harrison [MVP]: "Re: Reg. Access Violation When Accessing STL Object between a DLL and"
- Reply: Doug Harrison [MVP]: "Re: Reg. Access Violation When Accessing STL Object between a DLL and"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Feb 2005 00:41:02 -0800
Hi all,
One of MS KB article explains that there might be access violation when
we access a STL object created in one DLL or EXE through a pointer or
reference in a different DLL or EXE (
http://support.microsoft.com/kb/q172396/ ). To avoid this that article gives
two resolutions.
1. If the object is either static, or static data members of a class then we
need to
create an accessor method.
2. If the object is non-static data members of a class that are exported
from a DLL
or for automatic data then we have to Export the template class
instantiation
from one executable image and import it into the other executable images.
Please refer the above mentioned article for more details.
The same article refers one more article
http://support.microsoft.com/kb/168958/EN-US/)
which explains how to export STL Components Inside & Outside of a Class. In
that it says that map, set, queue, list, deque are all contain nested classes
and cannot be exported. So does that mean we can NOT have a class in a DLL
with <map> as a non-static member & use it in the EXE after importing?
Also it says that <basic_string> has been already exported by C Runtime
DLL(if symbol _DLL is defined), therefore you cannot export them from your
DLL. If it is already exported then why we need to write accessor methods
for accessing global string object as mentioned in the sample given in
article q172396? Also in that sample it does NOT refer a global or static
but a string object created in heap!!!!
Can anybody clarify this please? Or Please refer some good article or books
which give more info abt this.
Thanks & Regards,
Muthu Nivas.H
- Next message: Doug Harrison [MVP]: "Re: Reg. Access Violation When Accessing STL Object between a DLL and"
- Previous message: Doug Harrison [MVP]: "Re: std::map: clear throws an exception"
- Next in thread: Doug Harrison [MVP]: "Re: Reg. Access Violation When Accessing STL Object between a DLL and"
- Reply: Doug Harrison [MVP]: "Re: Reg. Access Violation When Accessing STL Object between a DLL and"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|