请教个wchar_t的问题
以wchar_t** 为参数的函数 放在dll文件里。在EXE文件中调用会出现 link 错误。请问怎么解决
函数如下:bool MiscUtils::LoadScriptFile(const char * inFile, wchar_t** outBuf)
{
// Open the .js file and read out the scripts.
FILE * fp = fopen(inFile, "rb ");
if (fp)
{
// First to determine the file size.
fseek(fp, 0, SEEK_END);
long fileSize = ftell(fp);
if (fileSize <= 0)
{
fclose(fp);
return false;
}
// Read scripts out of the source file.
long charCount = fileSize + 1; // including a null ternimator.
char * pScripts = new char[charCount];
memset(pScripts, 0, charCount);
fseek(fp, 0, SEEK_SET);
fread(pScripts, 1, fileSize, fp);
fclose(fp);
// Convert scripts to wide characters.
*outBuf = new wchar_t[charCount];
::MultiByteToWideChar(CP_ACP, 0, pScripts, -1, *outBuf, charCount);
delete[] pScripts;
return true;
}
return false;
}
[解决办法]
具体的Link错误是什么啊?
估计原因可能是:
1 忘了export?goodheartppl兄都一颗星星了,估计不会吧
2 EXE和DLL对于wchar_t的编译选项不同,请检查 "Treat wchar_t as build-in type "这一项的设置EXE和DLL是否相同
[解决办法]
什么错误??
[解决办法]
怎么不把错误贴出来?
LINK错误?
找不到XXX?
[解决办法]
LZ是不是导出类了