lsh 发表于 2005-5-26 10:50:31

有关lr_load_dll的问题

用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,
                     DWORDul_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.

不知道是为什么?

kernzhang 发表于 2005-5-26 11:47:12

1。lr_load-dll中参数是动态链接库的名字和全路径
2。你在C的功能里面的*.def文件中必须要定义你的函数说明

我做过测试,你如果在.def中部进行定义你的函数名,他将会报你所说的错误

lsh 发表于 2005-5-26 14:14:26

谢谢kernzhang,问题已经解决

mumu88 发表于 2009-9-23 12:37:01

lr_load_dll参数不定义动态连接库的全路径,直接放在脚本路径下,是否可以?定义路径为什么输入“\”会变为人民币的符号啊

GeorgeWangLC 发表于 2009-9-23 13:53:27

路过

学习啦
页: [1]
查看完整版本: 有关lr_load_dll的问题