All Forums Database
Kishore_1 208 posts Joined 03/10
16 Feb 2014
Compiling UDF with Object File

While compiling UDF in Teradata, We place the .c program of the function in a folder and compile the function structure in Teradata specifying the file path in the EXTERNAL NAME part.
How do we compile an UDF if we are given the object file (.o extn) of the function only?
Appreciate your help!!

Adeel Chaudhry 773 posts Joined 04/08
17 Feb 2014

I am not sure if you can do that. It appears you do have .c file, then why do you require to compile using an object file?

-- If you are stuck at something .... consider it an opportunity to think anew.

Alexander K 22 posts Joined 09/13
20 Feb 2014

In the CREATE (or REPLACE) FUNCTION statement, there is an option EXTERNAL NAME. To compile a UDF with a given object file, specify this option with the suboption CO in the string. As an example, let us assume the following:
Your objective file is called "myudf.o".
The function to use in the source code is called "myudffun(...)"
Then specify:
EXTERNAL NAME 'CO!myudf!<full_path_to_object_file>/myudf.o!F!myudffun!D!'
In general, you want to compile with the last D suboption when testing, because it enables the debugger.
As a reminder, if you worked with the source file "myudf.c" instead of the object file, then the above suboption would be correspondingly expressed as:
EXTERNAL NAME 'CS!myudf!<full_path_to_object_file>/myudf.c!F!myudffun!D!'
Hope this helps,

Alexander K 22 posts Joined 09/13
20 Feb 2014

See also:

Kishore_1 208 posts Joined 03/10
20 Feb 2014

Thanks Alexander for the answer and additional info:)
One last question: Is it possible to do a SHOW FUNCTION if function is compiled using .o (object) file.

You must sign in to leave a comment.