Hi Andreas,
It is quite odd that Alexei's suggestion does not work. Here is what I tried and this worked for me:
//USEUNIT Unit2
function Main()
{
defineKernel32Lib();
Unit2Test();
Log.Message(Project.Variables.kernel32Lib.GetTickCount());
}
function Unit2Test()
{
Log.Message(Project.Variables.kernel32Lib.GetTickCount());
}
function defineKernel32Lib()
{
if (null == Project.Variables.kernel32Lib) {
var Def_Environment = DLL.DefineEnvironment(true);
var Def_DLL = Def_Environment.DefineDLL("kernel32");
Def_DLL.DefineProc("GetTickCount", vt_i4);
Project.Variables.kernel32Lib = Def_Environment.Load("kernel32");
}
}
kernel32Lib is a temporary project variable of the Object type. The main idea is to declare all needed functions, load a library, put a library reference to a project variable and use this variable in any places where needed.