You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using JsonCPP library in my C++ project . I created a C++ dll with a function which will take Json::Value as input parameter . I have created another one exe which calls this function by passing Json::Value as argument. Inside the dll function, while reading this json value , it throws read access violation exception .
I was passing string as well which used to give error . I changed string to char* which resolves my problem . But I don't know how to handle passing json value .
below is the example code snippet .
C++ dll :
foo(json::value jsonValue)
{
auto value = jsonValue["name"];
}
another exe:
I linked dll with this exe project . And while debuging I can go inside foo function . so there is no problem in loading dll and calling function .
I am reading json from my local json file and storing it in jsonValue.
json::value jsonValue = readFromLocalFile();
cout<<jsonValue["name"]; // works well
foo(jsonValue); // goes inside foo function and breaks wile reading jsonValue["name"]
I am using visual studio 2019 to build both the projects .
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using JsonCPP library in my C++ project . I created a C++ dll with a function which will take Json::Value as input parameter . I have created another one exe which calls this function by passing Json::Value as argument. Inside the dll function, while reading this json value , it throws read access violation exception .
I was passing string as well which used to give error . I changed string to char* which resolves my problem . But I don't know how to handle passing json value .
below is the example code snippet .
C++ dll :
another exe:
I linked dll with this exe project . And while debuging I can go inside foo function . so there is no problem in loading dll and calling function .
I am reading json from my local json file and storing it in jsonValue.
I am using visual studio 2019 to build both the projects .
Can anyone please help me with this error .
Beta Was this translation helpful? Give feedback.
All reactions