Problem with Strings in DLL's

 

Following code works fine in old builds but not in 600+ builds. In new builds it only passes and get back first letter of the strings. Any one here to tell how to fix this for new builds??

#import "GlobalVariable.dll"
   int GV_SetNamedString(string StrName, string StrValue);
   string GV_GetNamedString(string StrName, string Error);
#import

int init()
{    
 return(0);
}

int deinit()
{    
 return(0);
}

int start()
{                                           
 int SetStr = GV_SetNamedString("abcd", "wxyz");
 string GetStr = GV_GetNamedString("abcd", "ERROR");
 Print("StringGotBack: ", GetStr); 
 return(0);
}
 
in the new build (600 >) strings are unicode
 
I tried like this but still no success.
#import "GlobalVariable.dll"
   int GV_SetNamedString(uchar & arr1[], uchar & arr2[]);
   string GV_GetNamedString(uchar & arr1[], uchar & arr2[]);
#import

int init()
{    
 return(0);
}

int deinit()
{    
 return(0);
}

int start()
{                                           
 string strname = "abcd";
 string strvalue = "wxyz";
 string err = "ERROR";
 uchar strname1[], strvalue2[], err2[];
 StringToCharArray(strname, strname1);
 StringToCharArray(strvalue, strvalue2);
 StringToCharArray(err, err2);
 int SetStr = GV_SetNamedString(strname1, strvalue2);
 string GetStr = GV_GetNamedString(strname1, err2);
 Print("StringGotBack: ", GetStr); 
 return(0);
}
 

what's the size of those arrays ?

uchar strname1[], strvalue2[], err2[];
 

what about

string GetStr = CharArrayToString(GV_GetNamedString(strname1, err2));


?

or maybe

string GetStr = GV_GetNamedString(CharArrayToString(strname1), CharArrayToString(err2));
 
qjol:

what about


?

I used code from this post:

https://www.mql5.com/en/forum/149321

Also CharArrayToString is not working.

 
upload your dll (into a zip file) maybe we'll figure out something
 
here is DLL.
Files:
 
string GetStr = GV_GetNamedString(strname1, err2);
 string value1 = CharArrayToString(strname1);
 string value2 = CharArrayToString(err2);
 
qjol:


Did you try this? Its not working.
 
anyone here with solution??