Simple Informix C UDR on Centos 6.6

Simple Informix C UDR on Centos 6.


#include "dmi/mi.h"

mi_integer bigger_int(mi_integer left,mi_integer right)
{
if ( left > right )
return(left);
else
return(right);
}

To compile

gcc -I$INFORMIXDIR/incl -I $INFORMIXDIR/incl/esql -c -fPIC -DMI_SERVBUILD -g bigger_int.c
gcc -shared -fPIC -o /home/informix/bigger_int.so bigger_int.o

To load and run

dbaccess sysmaster

create database justdave;

CREATE FUNCTION bigger_int (arg1 integer, arg2 integer) RETURNING integer
EXTERNAL NAME '/home/informix/bigger_int.so(bigger_int)'
LANGUAGE C;

select bigger_int(1,2) from systables where tabid=1;

DROP FUNCTION bigger_int;

Only when you execute the function is the shared library loaded

05:20:41  Loading Module
05:20:41  pid 3217: ELF .eh_frame section missing in /opt/IDS.12.10.FC5/gls/dll/64-libicudata.so.48
05:20:41  The C Language Module loaded

Advertisement


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s