HI,
I encountered a problem while I try to pass a char* object to a class method wrapped in a dll in VC++.
In the exe file, I have the following line
char List[255] = "hi";
vv Connection; // object declaration
//calling the function
Connection.UpdateList(char* ID, char*List);
ccout << List << endl;
In the dll file, I tried to put in either of the following lines in the class method UpdateList:
bool vv::Update(char* ID, char* List) {
.
.
.
case 1: std::streamstring S;
S << "x";
S >> List
case 2: List = "wa";
std::cout << List << std::endl;
}
With the code of Case 1, I got an error with memory stuff at runtime, but no compilation error. It seems like I cant store the value "x" into List.
With the code of Case 2, List store the value of "wa" while in the class method function, but when it returns from the dll function, it stores the value of "hi".
So I am just wondering how should I deal with character pointer object while passing it back and forth between exe and dll files?
Thanks a lot for the hlep in advance,
kim
I encountered a problem while I try to pass a char* object to a class method wrapped in a dll in VC++.
In the exe file, I have the following line
char List[255] = "hi";
vv Connection; // object declaration
//calling the function
Connection.UpdateList(char* ID, char*List);
ccout << List << endl;
In the dll file, I tried to put in either of the following lines in the class method UpdateList:
bool vv::Update(char* ID, char* List) {
.
.
.
case 1: std::streamstring S;
S << "x";
S >> List
case 2: List = "wa";
std::cout << List << std::endl;
}
With the code of Case 1, I got an error with memory stuff at runtime, but no compilation error. It seems like I cant store the value "x" into List.
With the code of Case 2, List store the value of "wa" while in the class method function, but when it returns from the dll function, it stores the value of "hi".
So I am just wondering how should I deal with character pointer object while passing it back and forth between exe and dll files?
Thanks a lot for the hlep in advance,
kim