Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands >
The SElib Object
In Siebel eScript, the SElib object allows calling out to external libraries.
SElib.dynamicLink() Method
Windows
SyntaxSElib.dynamicLink(Library, Procedure, Convention[, [desc,] arg1, arg2, arg3, ..., argn])
UNIX
SyntaxSElib.dynamicLink(Library, Procedure[, arg1, arg2, arg3, ...argn])
Returns
Not applicable
Usage
The calling convention must be one of the following:
Values are passed as 32-bit values. If a parameter is undefined when SElib.dynamicLink() is called, then it is assumed that the parameter is a 32-bit value to be filled in; that is, the address of a 32-bit data element is passed to the function, and that function sets the value.
If any parameter is a structure, then it must be a structure that defines the binary data types in memory to represent the following variable. Before calling the function, the structure is copied to a binary buffer as described in Blob.put() Method and Clib.fwrite() Method.
After calling the function, the binary data are converted back into the data structure according to the rules defined in Blob.get() and Clib.fread(). Data conversion is performed according to the current BigEndianMode setting. The function returns an integer.
Example
The following code example shows a proxy DLL that takes denormalized input values, creates the structure, and invokes a method in the destination DLL. In the process, it calls the SElib dynamicLink.
#include <windows.h>
_declspec(dllexport) int __cdecl
score (
double AGE,
double AVGCHECKBALANCE,
double AVGSAVINGSBALANCE,
double CHURN_SCORE,
double CONTACT_LENGTH,
double HOMEOWNER,
double *P_CHURN_SCORE,
double *R_CHURN_SCORE,
char _WARN_[5] )
{
*P_CHURN_SCORE = AGE + AVGCHECKBALANCE + AVGSAVINGSBALANCE;
*R_CHURN_SCORE = CHURN_SCORE + CONTACT_LENGTH + HOMEOWNER;
strcpy(_WARN_, "SFD");
return(1);
}The following example shows the eScript code required to invoke a DLL. In this code, the Buffer is used for pointers and characters.
function TestDLLCall3()
{
var AGE = 10;
var AVGCHECKBALANCE = 20;
var AVGSAVINGSBALANCE = 30;
var CHURN_SCORE = 40;
var CONTACT_LENGTH = 50;
var HOMEOWNER = 60;
var P_CHURN_SCORE = Buffer(8);
var R_CHURN_SCORE = Buffer(8);
var _WARN_ = Buffer(5);SElib.dynamicLink("jddll.dll", "score", CDECL,
FLOAT64, AGE,
FLOAT64, AVGCHECKBALANCE,
FLOAT64, AVGSAVINGSBALANCE,
FLOAT64, CHURN_SCORE,
FLOAT64, CONTACT_LENGTH,
FLOAT64, HOMEOWNER,
P_CHURN_SCORE,
R_CHURN_SCORE,
_WARN_);var r_churn_score = R_CHURN_SCORE.getValue(8, "float");
var p_churn_score = P_CHURN_SCORE.getValue(8, "float");
var nReturns = r_churn_score + p_churn_score;
return(nReturns);
}The following code calls a DLL function in the default codepage.
var sHello = "Hello";
Selib.dynamicLink("MyLib.dll", "MyFunc", CDECL, sHello);The following code calls a DLL function that passes Unicode strings.
var sHello = "Hello";
Selib.dynamicLink("MyLib.dll", "MyFunc", CDECL, WCHAR, sHello);The following code calls a DLL function that passes both Unicode and non-Unicode strings.
var sHello = "Hello";
var sWorld = "world";
Selib.dynamicLink("MyLib.dll", "MyFunc", CDECL, WCHAR, sHello, sWorld);
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |