DLL Object

ICE Data Services -

DLL Object
Previous  Top  Next


DLL Object

The eSignal EFS DLL Object allows you to interact with DLL files from within your EFS scripts.

DLL Methods

addFunction()
add an exported function
call()
call an exported function


Notes:

eSignal version 10.6 or earlier:

File location
To simplify the DLL load, place the DLL into \Program Files\eSignal.  Then when loading the DLL, just use DLL Name w/o a path.

var d = new DLL("FileName.dll")   
It will look into the 'current' (ie Program Files\eSignal) first.


eSignal version 11.0 or later:

File location
The DLL files must be located in either:
1. The same folder as the EFS or in the MyDocuments\Interactive Data\FunctionLibrary folder
In this case it is not required to define a path in the DLL call. The EFS engine will first search the folder containing the EFS and if no DLL is found it will search the FunctionLibrary folder.
2. A sub-folder of the folder containing the EFS or a sub-folder of the FunctionLibrary folder.
In this case a path is required in the DLL call. The path must be relative to the folder containing the EFS or to the FunctionLibrary folder.
Absolute paths are not allowed.
DLLs cannot be called if they are located outside of the Formulas or FunctionLibrary root folders, so any path that specifies a location outside of these folders will cause an error eg
var myVar = new DLL(“../myDLL.dll”); // generates an error
Specifying a relative path using parent references '../' is not recommended, it can be denied in future releases.
var myVar = new DLL(“myFolder/../myDLL.dll”); // not recommended  

64bit and 32bit
1. For the 64bit application the file needs to be a 64bit dll. The file name must have the characters x64 appended to it for example myDLLx64.dll
In the DLL() call the x64 suffix used in the file name must be omitted eg
var myVar = new DLL(“myDLL.dll”);

The formula engine will sense the 64bit environment and will automatically append the x64 suffix to the DLL call.
2. For the 32bit application the file needs to be a 32bit dll. No special file naming is required

This arrangement allows developers to include DLL files for both environments without the need to provide separate formulas





DLL.addFunction( refName, returnType, functionDefType, functionName [, parameters...] )

refName
text string to identify the function in EFS
returnType
the type of value that the DLL function returns. must be one of the following:

DLL.DOUBLE
DLL.INT
DLL.SHORT
DLL.FLOAT
DLL.STRING
functionDefType
the calling convention of the exported DLL function. must be one of the following:

DLL.CDECL
DLL.STDCALL

functionName
the name of the DLL function being called
parameters
the input parameters required by the exported DLL function, if any. the following parameter types are supported:

DLL.BYTE
DLL.STRING
DLL.SHORT
DLL.INT
DLL.FLOAT
DLL.DOUBLE 
DLL.FLOATARRAY
DLL.DOUBLEARRAY

   

Note:

functionName
is the name of the C/C++ function being called. Your compiler may mangle the function name. You will need to reference the MAP file generated by the linker to determine the actual name. In some cases the compiler prepends the function name with an underscore "_". In other cases the compiler mangles the function name.

DLLs must be plain C DLLs. They do NOT need to be registered (that is only for ActiveX/COM DLLs). MFC, .NET, etc.. are not supported. If someone surrounds C++ code with an extern "C" like below, no mangling of the names occurs, so the .map or .def file is unnecessary.
extern "C" __declspec(dllexport) int giveMe50() {
return 50;
}


Usage

var d = new DLL( "myTest.DLL");

function preMain() {

   d.addFunction(
"MyCallName", DLL.DOUBLE, DLL.CDECL, "Testing123", DLL.INT, DLL.STRING, DLL.FLOAT, DLL.DOUBLE, DLL.BYTE); 
}



DLL.call( refname [, parameters] )

refName
text string used to identify the function
parameters
actual values to pass to the DLL


Usage

var d = new DLL( "myTest.DLL" );

function preMain() {

   d.addFunction( 
"MyCallName", DLL.DOUBLE, DLL.CDECL, "Testing123", DLL.INT, DLL.STRING, DLL.FLOAT, DLL.DOUBLE, DLL.BYTE ); 

   
//in the above example:
   
//   "MyCallName" is the internal name we have assigned to the DLL function we are calling
   
//   DLL.DOUBLE is the type of value it returns (e.g., a double-precision number)
   
//   DLL.CDECL is the calling convention used by our DLL
   
//   "Testing123" is the actual function name of the exported DLL function.
   
//   DLL.INT signifies that the first input parameter is an integer
   
//   DLL.STRING signifies that the second input parameter is a string
   
//   DLL.FLOAT signifies that the third input parameter is a float
   
//   DLL.DOUBLE signifies that the fourth input parameter is a double
   
//   DLL.BYTE signifies that the fifth input parameter is a byte

}


function main() {
var retVal;

   retVal = d.call( 
"MyCallName"123"hello world"456.23544.0014053255 ); 

}