473,473 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Access an STL object through a pointer or reference in a different DLL or EXE

mos
Hi!

According the article:
You may experience an access violation when you access an STL object
through a pointer or reference in a different DLL or EXE
http://support.microsoft.com/default...en-us%3b172396
But I wonder which stl object can access and which not, I have used
std::iostream and std::string this way and seems ok, I know std::map can
not, is there any more? The question confused me much.

Best regard
mos.
Mar 19 '07 #1
4 2280
On Mar 19, 9:23 am, "mos" <mmosqu...@163.comwrote:
Hi!

According the article:
You may experience an access violation when you access an STL object
through a pointer or reference in a different DLL or EXEhttp://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b172396
But I wonder which stl object can access and which not, I have used
std::iostream and std::string this way and seems ok, I know std::map can
not, is there any more? The question confused me much.

Best regard
mos.
I'm using the stl between dll's and exe's all the time. You have to
watch out which runtime library you link. In Visual Studio you have to
check it in "Code Generation". It must be one of the DLL versions.

Mar 19 '07 #2
On 19 Mar, 13:02, abloc...@googlemail.com wrote:
On Mar 19, 9:23 am, "mos" <mmosqu...@163.comwrote:
Hi!
According the article:
You may experience an access violation when you access an STL object
through a pointer or reference in a different DLL or EXEhttp://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b172396
But I wonder which stl object can access and which not, I have used
std::iostream and std::string this way and seems ok, I know std::map can
not, is there any more? The question confused me much.
Best regard
mos.

I'm using the stl between dll's and exe's all the time. You have to
watch out which runtime library you link. In Visual Studio you have to
check it in "Code Generation". It must be one of the DLL versions.
For the app, the DLL or both?

--
Erik Wikström

Mar 19 '07 #3
mos
Hi!
I test the article's example, dll use /MTd exe use /MLd but no access
violation occur, but I indeed meet such things.
according to reason in the aticle:

Most classes in the Standard C++ Libraries use static data members directly
or indirectly. Since these classes are generated through template
instantiation, each executable image (usually with DLL or EXE file name
extensions) will contain its own copy of the static data member for a given
class. When a method of the class that requires the static data member is
executed, it uses the static data member in the executable image in which
the method code resides. Since the static data members in the executable
images are not in sync, this action could result in an access violation or
data may appear to be lost or corrupted.

seems reasonable, so I'am still confused

<ab******@googlemail.com>
??????:11*********************@l77g2000hsb.googleg roups.com...
On Mar 19, 9:23 am, "mos" <mmosqu...@163.comwrote:
>Hi!

According the article:
You may experience an access violation when you access an STL object
through a pointer or reference in a different DLL or
EXEhttp://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b172396
But I wonder which stl object can access and which not, I have used
std::iostream and std::string this way and seems ok, I know std::map can
not, is there any more? The question confused me much.

Best regard
mos.

I'm using the stl between dll's and exe's all the time. You have to
watch out which runtime library you link. In Visual Studio you have to
check it in "Code Generation". It must be one of the DLL versions.

Mar 20 '07 #4
"mos" <mm*******@163.comwrote in message
news:et**********@news.yaako.com...
Hi!

According the article:
You may experience an access violation when you access an STL object
through a pointer or reference in a different DLL or EXE
http://support.microsoft.com/default...en-us%3b172396
But I wonder which stl object can access and which not, I have used
std::iostream and std::string this way and seems ok, I know std::map can
not, is there any more? The question confused me much.
Are you using either Visual C++ 5.0 or 6.0?

This was fixed in VS 2003.

Dennis
Apr 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
29
by: web1110 | last post by:
If I have 2 variables, A and B, referencing the same object and then do a A.Dispose(), what happens to B?
12
by: Belebele | last post by:
Suppose that a class A depends on class B because an object of class B is passed into A's constructor. See below: class B { ... }; class A { public: A(B const& b); ... };
10
by: Goran Djuranovic | last post by:
Hi all, Does anyone know how to declare a variable in a class to be accessible ONLY from a classes instantiated within that class? For example: ************* CODE ***************** Public...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
32
by: Joe | last post by:
I am just starting to use Object Oriented PHP coding, and I am seeing quite often the following (this example taken from a wiki): $wakka =& new Wakka($wakkaConfig); What exactly is the =&, and...
10
by: blangela | last post by:
If I pass a base class object by reference (likely does not make a difference here that it is passed by reference) as a parameter to a derived class member function, the member function is not...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.