Products Downloads


French version


 


Both designations for the instruction are equivalent.


      

VADELIA

SADELIA

WADELIA

EADELIA


(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(B) (C/S)


Warning: This instruction is ignored on a server part generated for AS/400.


Section for use

All except AS/400 Server sections.


Syntax

CALL_DLL DLLorClassName Function_Method SeriesParameters NonUnicode

or

CALL_CLASS DLLorClassName Function_Method SeriesParameters NonUnicode


DLLorClassName

'AlphaConstant'



| PgmName



| &AlphaVarId




Function_Method

'AlphaConstant' | &AlphaVarId




SeriesParameters

SeriesParameters Parameter | None




NonUnicode


*NON_UNICODE | None


Description

This instruction corresponds to the call of the function Function_Method of a Windows DLL DLLorClassName where it is used from a Windows client part of a VADELIA program, from a Windows server part of a VADELIA or WADELIA program, or from a SADELIA program generated for Windows.


It corresponds to the call of the method Function_Method of a Java class DLLorClassName where it is used from a client part of a WADELIA program, from a Java client part of a VADELIA program, a Java server part of a VADELIA or WADELIA program, or at last, a SADELIA program generated in Java.


If the DLL, or the class, has already been loaded into memory, just call the function Function_Method, using its parameters SeriesParameters.

If the DLL, or the class, has not yet been loaded, load it, call the function Function_Method, using its parameters SeriesParameters, then unload the DLL.


The name of the DLL or of the class can be an alphanumeric constant, the guide word for a program in the glossary or a variable preceded by the "&" character.


The function or method name must take the form of an alphanumeric constant or variable.


Warning: For the function or method name, you must distinguish between upper and lower case.


The parameters can be variables (entered by reference) or constants. The return value of the function or method is not retrieved.


Important note:

Where the parameter is a constant:

    • If the function is to receive a NUM_BIN_4 or NUM_E(n,0) or NUM_P(n,0) parameter where n <= 9, the constant must be an integer with no more than 9 digits.
    • If the function is to receive a NUM_E(n,0) or NUM_P(n,0) parameter where n > 9, the constant must be an integer with more than 9 digits (if necessary packed with leading zeros).
    • If the function is to receive a NUM_E(x,d) or NUM_P(x,d) parameter where d > 0, the constant must be a decimal number.
    • If the function is to receive a NUM_BIN_8 parameter, the constant must be an integer with no more than 19 digits..


When the CALL_DLL instruction is placed in a Windows server or client part of a program generated in Unicode, the *NON_UNICODE option can be used to convert ALPHA ("unicode") parameters to "single-byte".

This parameter is ignored if the instruction is placed in a Java or Web client or in a Java or AS/400 server part, or if the program is generated in non-Unicode mode.


*NON_UNICODE is not permitted in the following cases:

- if any of the parameters is a LIST,

- if any of the parameters is a DS,

- if a VaToolBox function is called.


To check whether the call has been made successfully, you can test the *RETURN_CODE reserved word.


Possible values:

0: The called function or class has been found and run.

1: The DLL or class has not been found or cannot be loaded or, the called function or method has not been found in the DLL or class.

2: The called function or method has been found but not run, as the parameter control stopped execution (mode without execution).


Example

CALL_DLL '\MY_DLLS\CUSTLST.DLL' 'CUSTLST_LOAD' Customer_Code


CALL_DLL CUSTOMER_LIST 'CUSTLST_LOAD' CUST_CODE


CALL_DLL &DLL_NAME &FunctionName CUST_CODE


LOAD_DLL 'VaToolBx.dll'

CALL_DLL 'VaToolBx.dll' 'VaToolBxFbeep' Freq Duration RetCode

...

UNLOAD_DLL 'VaToolBx.dll'


Other example application: calling an external Java class method

Source of the external class: all the methods liable to be called must be public and have only one Object[] parameter (mandatory). This array contains the method's various parameters (parameters are supplied by reference, and their values can be changed).

The various parameters are accessible using (specific cast) ParamArr[x-1], where x is the index of the parameter in 4GL (cf. example).

These are the only restrictions. The parameters are unaffected by packages, the type returned by the method, exception management, etc.


package myPackage; // (optional)

import ...

public class myClass

{

public void myFunctionWithNoParameter (Object[] ParamArr)

{

...

}

public void myFunctionWithTwoParameters (Object[] ParamArr)

{

// Using the first parameter (NUM_BIN_4 type)

.. (Integer) ParamArr [0]..


// Using the second parameter (ALPHA type)

.. (String) ParamArr [1]..


// Cast to be done according to the variable's Adelia type

// String Short Integer Long Double Boolean HaBlob

}

}


=> CALL_CLASS 'myPackage.myClass' ' myFunctionWithNoParameter'

=> CALL_CLASS 'myPackage.myClass' ' myFunctionWithTwoParameters' myBIN4Var myALPHAVar



↑ Top of page

  • Aucune étiquette