以下是调用dll的部分以及错误提示,其中fenci.dll中有DivideSentence函数,并且带三个字符串参数,第一个是路径,第二个是待分词的字符串,第三个是结果串。
自己才学习vc,怎么也弄不明白,请教了!//调用dll
typedef int (CALLBACK* LPFNDLLFUNC1)(char*,char*,char*);HINSTANCE hDLL;               // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1;    // Function pointer
char* s1,s2,s3;
int uReturnVal;
s1="d:";
s2="中国地人民";
s3=NULL;
hDLL =LoadLibrary("fenci.dll");
if (hDLL != NULL)
{
   lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"DivideSentence");
   if (!lpfnDllFunc1)
   {
      // handle the error
      FreeLibrary(hDLL);       
      return 1;
   }
   else
   {
      // call the function
      uReturnVal = lpfnDllFunc1(s1,s2,s3);
   }
}////////////////////////
D:\programs\Microsoft Visual Studio\MyProjects\z202\z202.cpp(33) : error C2440: '=' : cannot convert from 'char [11]' to 'char'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\programs\Microsoft Visual Studio\MyProjects\z202\z202.cpp(48) : error C2664: 'int (char *,char *,char *)' : cannot convert parameter 3 from 'char' to 'char *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
D:\programs\Microsoft Visual Studio\MyProjects\z202\z202.cpp(48) : error C2664: 'int (char *,char *,char *)' : cannot convert parameter 2 from 'char' to 'char *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.z202.exe - 3 error(s), 0 warning(s)