Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The SElib ObjectIn Siebel eScript, the SElib object allows calling out to external libraries and applications. SElib.dynamicLink() MethodThis method calls a procedure from a dynamic link library (Windows) or shared object (UNIX). Windows SyntaxSElib.dynamicLink(Library, Procedure, Convention[, [desc,] arg1, arg2, arg3, ..., argn]) UNIX SyntaxSElib.dynamicLink(Library, Procedure[, arg1, arg2, arg3, ...argn]) NOTE: On UNIX, the total number of parameters passed with SElib.dynamicLink() must not exceed 22. These 22 parameters include the shared library name and the procedure name, so you can pass up to 20 additional parameters. UsageThe 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. ExampleThe following code example shows a proxy DLL that takes denormalized input values, creates the structure, and invokes a method in the destination DLL. The defined method score is called by SElib dynamicLink in the subsequent example code. #include <windows.h> 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() SElib.dynamicLink("jddll.dll", "score", CDECL, var r_churn_score = R_CHURN_SCORE.getValue(8, "float"); The following code calls a DLL function in the default codepage: var sHello = "Hello"; The following code calls a DLL function that passes Unicode strings. var sHello = "Hello"; The following code calls a DLL function that passes both Unicode and non-Unicode strings. var sHello = "Hello"; The following example shows how to call an external application and pass it arguments (0, 0, and 5): SElib.dynamicLink("shell32", "ShellExecuteA", STDCALL, 0, "open", "c:\\Grabdata.exe", 0, 0, 5). See alsoSElib.peek() MethodThis method reads data from a specific position in memory. SyntaxSElib.peek(address[, dataType]) ReturnsThis method returns the data specified by dataType. UsageThis method reads (or gets) data from the position in memory to which the address argument points. The dataType parameter specifies how many bytes to read and how to interpret the data. CAUTION: Routines that work with memory directly should be used with caution. To avoid destroying or moving data unexpectedly , you should clearly understand memory and the operations of these methods before using them. ExampleTheApplication().TraceOn("c:\\eScript_trace.txt","allocation","all"); The script produces the following trace output: SElib.pointer() MethodThis method gets the address in memory of a Buffer variable. SyntaxReturnsThis method returns the address of (a pointer to) the Buffer variable identified by varName. UsageThis method gets the address in memory of the first byte of data in a Buffer variable. For information on the Buffer object, see Buffer Objects in Siebel eScript. CAUTION: A pointer is valid only until a script modifies the variable identified by bufferVar or until the variable goes out of scope in a script. Putting data in the memory occupied by bufferVar after such a change is dangerous. When data is put into the memory occupied by bufferVar, be careful not to put more data than will fit in the memory that the variable actually occupies. ExampleTheApplication().TraceOn("c:\\eScript_trace.txt","allocation","all"); The script produces the following trace output: See alsoSElib.peek() Method SElib.poke() MethodThis method writes data to a specific position in memory. SyntaxSElib.poke(address, data[, dataType]) ReturnsThis method returns the address of the byte that follows the data that is written to memory. UsageThis method writes data to the position in memory to which the address argument points. The data to be written must match the type given by the dataType argument , or its default value if not provided. The dataType argument specifies how many bytes to write and how to interpret the data. CAUTION: Routines that work with memory directly should be used with caution. To avoid destroying or moving data unexpectedly , you should clearly understand memory and the operations of these methods before using them. ExampleTheApplication().TraceOn("c:\\eScript_trace.txt","allocation","all"); The script produces the following trace output: See alsoSElib.peek() Method |
Siebel eScript Language Reference |