UDF error when create a cplusplus function

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Fan

UDF error when create a cplusplus function

Hi everyone,

 

I downloaded TeradataVM and  i execute sucessfull some of examples with UDF C functions in eclipse and td like below.

https://downloads.teradata.com/extensibility/articles/udf-debugging/debug-an-aggregate-cudf-using-ec...

http://downloads.teradata.com/extensibility/articles/udf-debugging/debug-a-scalar-cudf-using-eclipse

 

But when i try to make cpp code same as plusudf example, i am getting errors. 

Actually the error codes is not clear for me.

Thank you,

 

CREATE FUNCTION plusplusudf(
a INTEGER,
b INTEGER
) RETURNS INTEGER
LANGUAGE CPP
NO SQL
PARAMETER STYLE TD_GENERAL
EXTERNAL NAME 'D!CS!plusplusudf!/usr/eclipse/workspace/cudf_scalarcpp/src/plusplusudf.cpp';

 

Executed as Single statement.  Failed [5603 : HY000] Errors encountered in compiling UDF/XSP/UDM/UDT/JAR.{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] /usr/bin/gcc -D_REENTRANT -D_LIBC_REENTRANT -g -gdwarf-2    -I/usr/tdbms/et
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] c   -L/usr/tdbms/lib  -fpic -c plusplusudf.cpp
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] /usr/bin/gcc -D_REENTRANT -D_LIBC_REENTRANT -g -gdwarf-2    -I/usr/tdbms/et
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] c   -L/usr/tdbms/lib  -fpic -c Teradata_new_delete.cpp
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] /usr/bin/gcc -D_REENTRANT -D_LIBC_REENTRANT -g -gdwarf-2    -I/usr/tdbms/et
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] c   -L/usr/tdbms/lib   -fpic -c  pre_plusplusudf.c
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] /usr/bin/gcc -shared -fpic -Xlinker -rpath -Xlinker /usr/tdbms/lib -Wl,--ve
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] rsion-script=/var/opt/teradata/tdtemp/UDFTemp/0408.30719.1d09e/UserUdf_vers
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] ions.scr -D_REENTRANT -D_LIBC_REENTRANT -g -gdwarf-2    -I/usr/tdbms/etc   
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] -L/usr/tdbms/lib  -o @FileList    -ludf  -lm -ljil -lstdc++ 
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] /var/opt/teradata/tdtemp/UDFTemp/0408.30719.1d09e/libudf_0408_5.so: undefin
}{Nested Failure Msg [5603 : HY000] [Teradata Database] [TeraJDBC 16.10.00.03] [Error 5603] [SQLState HY000] ed symbol: plusplusudf
} 
Elapsed time = 00:00:01.619 
 
STATEMENT 1: Create Function failed. 
3 REPLIES
Teradata Employee

Re: UDF error when create a cplusplus function

The message says that it expected to find an entry point (function name) plusplusudf for your function, but it did not.

Use the "F" specification in the EXTERNAL NAME clause to specify the entry point name, if it's not exactly the same as the (specifc) function name.

Fan

Re: UDF error when create a cplusplus function

Thank you for your response

 

when i change with F  in external file , i  get below error.

 

EXTERNAL NAME 'F!plusplusudf!/usr/eclipse/workspace/cudf_scalarcpp/src/plusplusudf.cpp';

 

Executed as Single statement.  Failed [5594 : HY000] Invalid external file option specified for UDF/XSP/UDM/UDT 'plusplusudf'. 
Elapsed time = 00:00:00.016 
 
STATEMENT 1: Create Function failed. 
Teradata Employee

Re: UDF error when create a cplusplus function

You still need the CS (and the D if you want debugging). The F would be in addition.

 

EXTERNAL NAME 'D!CS!plusplusudf!/usr/eclipse/workspace/cudf_scalarcpp/src/plusplusudf.cpp!F!actualFunctionName'