Forum Discussion

tyrus's avatar
tyrus
Contributor
9 years ago

DLL issue

Hi I have a win dll with  method:

 

//TestingtDLL.dll

extern "C" __declspec(dllexport) const char* md5(const char* fileName)
{
    return fileName;
}

 

I try calling through TC and I get errors

 

function MD5()
{

var Def_DLL1 = DLL.DefineDLL("TestingtDLL.dll");
var Lib1 = DLL.Load("TestingtDLL.dll");
var loaded = Def_DLL1.DefineProc("md5", vt_lpstr, vt_lpstr);
var text = "test";
var LpStr = DLL.New("LPSTR", text.length)
LpStr.Text = "test";
var result = Lib1.md5(LpStr);
}

 

FYI this version below works fine, it is perhaps something to do with the parameter list abaove that is causing issues??

 

//TestingtDLL.dll

extern "C" __declspec(dllexport) const char* md5()
{
    return "fileName";
}

 

function MD5()
{

var Def_DLL1 = DLL.DefineDLL("TestingtDLL.dll");
var Lib1 = DLL.Load("TestingtDLL.dll");
var loaded = Def_DLL1.DefineProc("md5", vt_lpstr);
var result = Lib1.md5();
}

        
any ideas?