[xml] Attempted to read or write protected memory



Hi

I am facing this problem in Visual Studio 2005 using VB-2005 and native unmanaged c++ dll which in turn uses libxml2.

"Attempted to read or write protected memory. This is often an indication that other memory has been corrupted. "


I will try to explain the problem in a simplistic approach as its difficult to paste the coding bits because its a bit elaborative out there.

VB-2005 --> MyDLL.dll <-- libxml2

I am calling exported functions from MyDLL.dll into my VB application and all seems to be working fine until I started getting the above error under a certain condition.

Say if all my exported functions are in a.cpp which I call, I have also declared certain global variables like

int d_winnerModels;
float d_Prob;
xmlNodePtr gramCur;
set<long> currentGrammarModels;
.
.
.

which gets populated during some initialisation calls to a.cpp

In a file b.cpp I am using certain global variables using extern statement like,

extern int d_winnerModels;
extern float d_Prob;
extern xmlNodePtr gramCur;
extern set<long> currentGrammarModels;


My other global variables like vectors, sets, integers etc seem to work fine but for the above libxml related variable (gramCur) I am getting the above error.

Has anyone got a clue of what extra care needs to be taken or is it some complier optimisation issue for third part dll's. I am running everything in debug mode so I guess all optimisations are automatically switched off...


Any help/ thought will be greatly appreciated

Sid


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]