Search code examples
sybaseredhatuser-defined-functionsudfsap-iq

Could not find function in dynamic library 'libudfex.so'


Accroding to IQ' udf guide,

create udf procedure as below:

  1. Declare the UDF to the server by using the CREATE FUNCTION or CREATE AGGREGATE FUNCTION

  2. Write the UDF library identification function

  3. Define the UDF as a set of C or C++ functions.

  4. Implement the function entry points in C/C++.

  5. Compile the UDF functions and the library identification functions
  6. Link the compiled file into a dynamically linkable library.

After I alreary done the all procedure, and Declare CREATE FUNCTION in Interactice SQL, I call function and got error response as below:

`

Could not execute statement.

Could not find 'my_sample_function' in dynamic library 'libudfex.so' SQLCODE=-621, ODBC 3 State="HY000" Line 1, column 1 SELECT my_sample_function(test.a, test.b) as aaa FROM test WHERE test.a = 3

`


Solution

  • http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01034.1520/doc/html/jfo1254246965959.html

    After the dynamically linkable library has been compiled and linked, complete one of these tasks:

    1.(Recommended) update the CREATE FUNCTION ... EXTERNAL NAME to include an explicit path name for the UDF library. Place the UDF library file into the directory where all the IQ libraries are stored.

    2.Start the IQ server with a library load path that includes the location of the UDF library.

    3.On UNIX modify the LD_LIBRARY_PATH within the start_iq startup script. While LD_LIBRARY_PATH is universal to all UNIX variants, SHLIB_PATH is preferred on HP, and LIB_PATH is preferred on AIX.

    Maybe you miss this step