dll里的函数:
void WINAPI TestParam (const string& name, const string& psword)
{
if (0 == name.compare ("Adams") && 0 == psword.compare ("111111"))
{
printf ("input correct!\n");
}
else
{
printf ("input incorrect!\n Please input again.\n");
}
}
我做的转换如下:
//我的参数:用户名和密码都保证是英文的
typedef void (WINAPI *Test_API) (const std::string& nn, const std::string& pp);
..................
Test_API test_api = ...........;
QString name ("Adams");
QString psWd ("111111");
std::string uName = name.toStdString ();
std::string uPswod = psWd.toStdString ();
test_api (uName , uPswod)的调用输出结果是 input incorrect! Please input again