Skip to main content

IMPORT

resulttype funcname ( parameterlist ) := IMPORT( language, function );

resulttypeThe ECL return value type of the function.
funcname

The ECL definition name of the function.

parameterlistA comma separated list of the parameters to pass to the function.
languageSpecifies the name of the external programming language whose code you wish to embed in your ECL. A language support module for that language must have been installed in your plugins directory. Modules are provided for languages such as Java, R, Javascript, and Python. You can write your own pluggable language support module for any language not already supported by using the supplied ones as examples or starting points.
functionA string constant containing the name of the function to include.

The IMPORT declaration allows you to call existing code written in the external language. This may be used to call Java or Python code, but is not usable with Javascript or R code (use the EMBED structure instead). Java code must be placed in a .java file and compiled using the javac compiler in the usual way. All Java classes used must be thread safe.

WARNING: This feature could create memory corruption and/or security issues, so great care and forethought are advised--consult with Technical Support before using.

Example:

IMPORT Python;

INTEGER addthree(INTEGER p) := IMPORT(Python, 'python_mod_name.addThree');

//Java Example setting the classpath
IMPORT java;
STRING jcat(STRING a, STRING b) := 
        IMPORT(java, 'JavaCat.cat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;'
        : classpath('/opt/HPCCSystems/classes/'));
jcat('I',' concatenate');

See Also: IMPORT, EMBED Structure