大概的代码如下,大家帮忙解决一下,谢谢啦
调用TEST.DLL的程序如下
typedef bool (*PFN_test)(LPCTSTR first,LPCTSTR second,BOOL bFailIf);
int _tmain(int argc, TCHAR* argv[])
{
HINSTANCE hinstDLL;
PFN_test test1;
BOOL fFreeDLL;
hinstDLL = LoadLibrary("test.dll");
if (hinstDLL != NULL)
{
test1= (PFN_test) GetProcAddress(hinstDLL, "test1");
if (test1 != NULL)
printf("ok");
fFreeDLL = FreeLibrary(hinstDLL);
} }
编译后出现错误:
test.dll warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
test.dll error C2018: unknown character '0x3'
test.dll error C2018: unknown character '0x4'
test.dll error C2018: unknown character '0x40'
test.dll error C2018: unknown character '0xe'
……………………
如此的错误一百多个dll的主要代码test.cpp如下
#include "stdafx.h"
#include "test.h"
#include <shlwapi.h>
#pragma comment( lib, "shlwapi.lib") #ifdef _MANAGED
#pragma managed(push, off)
#endifBOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}#ifdef _MANAGED
#pragma managed(pop)
#endiftest_API int fntest(void)
{
return 42;
}// This is the constructor of a class that has been exported.
// see test.h for the class definition
Ctest::Ctest()
{
return;
}//自己的函数,需要调用的函数
bool geterror()
{
}
bool test1(LPCTSTR first,LPCTSTR second,BOOL bFailIfExists)
{
}
调用TEST.DLL的程序如下
typedef bool (*PFN_test)(LPCTSTR first,LPCTSTR second,BOOL bFailIf);
int _tmain(int argc, TCHAR* argv[])
{
HINSTANCE hinstDLL;
PFN_test test1;
BOOL fFreeDLL;
hinstDLL = LoadLibrary("test.dll");
if (hinstDLL != NULL)
{
test1= (PFN_test) GetProcAddress(hinstDLL, "test1");
if (test1 != NULL)
printf("ok");
fFreeDLL = FreeLibrary(hinstDLL);
} }
编译后出现错误:
test.dll warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
test.dll error C2018: unknown character '0x3'
test.dll error C2018: unknown character '0x4'
test.dll error C2018: unknown character '0x40'
test.dll error C2018: unknown character '0xe'
……………………
如此的错误一百多个dll的主要代码test.cpp如下
#include "stdafx.h"
#include "test.h"
#include <shlwapi.h>
#pragma comment( lib, "shlwapi.lib") #ifdef _MANAGED
#pragma managed(push, off)
#endifBOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}#ifdef _MANAGED
#pragma managed(pop)
#endiftest_API int fntest(void)
{
return 42;
}// This is the constructor of a class that has been exported.
// see test.h for the class definition
Ctest::Ctest()
{
return;
}//自己的函数,需要调用的函数
bool geterror()
{
}
bool test1(LPCTSTR first,LPCTSTR second,BOOL bFailIfExists)
{
}
还是有很多错误
1>test.dll : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>test.dll(1) : error C2018: unknown character '0x3'
1>test.dll(1) : error C2018: unknown character '0x4'
1>test.dll(1) : error C2018: unknown character '0x40'
1>test.dll(1) : error C2018: unknown character '0xe'
1>test.dll(1) : error C2018: unknown character '0x1f'
1>test.dll(1) : error C2146: syntax error : missing ';' before identifier ''
1>test.dll(1) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>test.dll(1) : error C2143: syntax error : missing ';' before '?'
1>test.dll(1) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2143: syntax error : missing ';' before '}'
1>test.dll(2) : error C2059: syntax error : '}'
1>test.dll(2) : error C2018: unknown character '0x14'
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2018: unknown character '0x1c'
1>test.dll(2) : error C2018: unknown character '0x13'
1>test.dll(2) : error C2015: too many characters in constant
1>test.dll(2) : error C2018: unknown character '0x3'
1>test.dll(2) : error C2018: unknown character '0x1f'
1>test.dll(2) : error C2014: preprocessor command must start as first nonwhite space
1>test.dll(2) : error C2018: unknown character '0x1e'
1>test.dll(2) : error C2014: preprocessor command must start as first nonwhite space
1>test.dll(2) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>test.dll(2) : fatal error C1004: unexpected end-of-file found
提示Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.