以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;
}
{
// 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;
}
解决方案 »
- 为什么类型不匹配?
- 有没有对重载运算符比较了解的人 请问这段程序为什么出错
- free函数运行时错误,求教牛人点津!
- 如何实现点击窗口客户区和非客户区都不能激活窗口?
- 生成Dll的问题
- msxml3.dll初始化为什么失败?
- 400元求解:困惑很久的一个问题
- 请问微软专家,Handling Errors in transaction
- VS中怎样将cmd中命令行的格式转换为工具栏或菜单栏上的按键响应
- 诸位同仁请教有关图像处理vc++程序的问题.我想找一些源代码,简单点的也可以[email protected]
- 急急!!.dsw文件双击键无法打开,单击右键发现右键菜单第一项是“what is this?” 这是怎么回事
- 内存泄露,急!!!!!
估计原因可能是:
1 忘了export?goodheartppl兄都一颗星星了,估计不会吧
2 EXE和DLL对于wchar_t的编译选项不同,请检查"Treat wchar_t as build-in type"这一项的设置EXE和DLL是否相同
LINK错误?
找不到XXX?