In my vb.net code I want to call a dll file created by Qt4.
Now everything works fine untill and unless I pass some string argument to the function.
Here is the function in dll file:
and here is how I am calling it in vb.net:
When the function returns some constant value, say if i put result = "Abhijit" then it returns the value properly. But if I want result to return value url the it is returning some garbage values.
Thanks in advance for any help.
Now everything works fine untill and unless I pass some string argument to the function.
Here is the function in dll file:
Code:
const char* QtEngineDll::randInt(char url[])
{
QString result;
/*QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QByteArray d = codec->fromUnicode(url);
result= QString(d.length());
QString fileName = QDir::currentPath() + "/Test.txt";
QFile file(fileName);
file.open(QIODevice::Append | QIODevice::Text);
file.write(result + "\n");*/
return result;
}
Code:
<DllImport("G:\test\debug\test.dll", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function randInt(ByVal u As StringBuilder) As StringBuilder
End Function
Thanks in advance for any help.
Comment