how to send string from/To C++ (6.0) to C++ DLL?
- by Ahmed Mostafa
When I send text to my DLL and receive it as char*, something strange happens; if the text is less than 13 characters or greater than 77 characters the text returned is rubbish!
Here is my code:-
//(1) DLL function:
char* __stdcall ApplyArabicMapping( char* input)
{
// 1-Conver char* to string
std::string inputString = input;
// 2-Calling our function
string encodedStr = Encoding::arabicHandling(inputString);
// 3-Convert from String to char*
char* returnStr = (char*)encodedStr.c_str();
return (returnStr);
}
//(2) Calling from C++ console application:
char* inputStr = "Some text";
char* resutls = ApplyArabicMapping(inputStr);