|
用C语言录制的脚本,现有VC++写的dll,用lr_load_dll调用时出错,请各位帮忙看看
DecodeString.dll的源码:
DecodeString.h
#ifdef DECODESTRING_EXPORTS
#define DECODESTRING_API __declspec(dllexport)
#else
#define DECODESTRING_API __declspec(dllimport)
#endif
// This class is exported from the DecodeString.dll
class DECODESTRING_API CDecodeString {
public:
CDecodeString(void);
// TODO: add your methods here.
};
extern "C" DECODESTRING_API int nDecodeString;
DECODESTRING_API int fnDecodeString(void);
-----------------------------------------------------------------------
DecodeString.cpp:
#include "stdafx.h"
#include "DecodeString.h"
BOOL APIENTRY DllMain( HANDLE 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;
}
// This is an example of an exported variable
DECODESTRING_API int nDecodeString=0;
// This is an example of an exported function.
DECODESTRING_API int fnDecodeString(void)
{
return 42;
}
//Max function
DECODESTRING_API int Max(int a, int b)
{
if(a>=b)return a;
else
return b;
}
//Min function
DECODESTRING_API int Min(int a, int b)
{
if(a>=b)return b;
else
return a;
}
// This is the constructor of a class that has been exported.
// see DecodeString.h for the class definition
CDecodeString::CDecodeString()
{
return;
}
/////////////在action中调用的代码为:
lr_load_dll(str);
c=fnDecodeString();-------Error -- Unresolved symbol : fnDecodeString.
不知道是为什么? |
|