Quantcast
Channel: IIUG Forum: IDS Forum
Viewing all articles
Browse latest Browse all 9843

Re: C Language UDR on RedHat

$
0
0
Why don't you just use onstat -g env? :-) -- Regards Spokey > On 21 Aug 2014, at 03:00, "RAY BURNS"<ray.burns@velocityglobal.co.nz> wrote: > > Im making my first foray into C UDRs. Im using Informix 12.10 (c1) and > using Redhat 6.3. > > As a test I decided to write a simple C routine that returns an environment > variable: > > #include "dmi/mi.h"> #include "stdlib.h"> > mi_lvarchar *igetenv(mi_lvarchar *str,MI_FPARAM *fparam) > { > > mi_lvarchar *lvarch_out; > > char *varname; > > char *varvalue; > > varname = mi_lvarchar_to_string(str); > > varvalue = getenv(varname); > > lvarch_out = mi_string_to_lvarchar(varvalue); > > return (lvarch_out); > } > > I compiled it with : > gcc I$INFOMRIXDIR/incl fPIC g c Wall DMI_SERVBUILD igetenv.c > and > gcc shared fPIC W1,--version-script=igetenv.exportlist o /tmp/igetenv.so > igetenv.o lc > > I then registered it with: > > CREATE FUNCTION sql_igetenv(lvarchar) > RETURNS lvarchar > with (NOT VARIANT,PARALLELIZABLE) > EXTERNAL NAME "/tmp/igetenv.so(igetenv)"> LANGUAGE c; > > And ran it with : > > execute function sql_igetenv('INFORMIXDIR') > > I get the error message: > > Error: User Defined Routine (sql_igetenv) load failed. (State:S1000, Native > Code: FFFFD9BE) > And the log has the following: > 13:52:09 ERROR: C Language Symbol <igetenv> (procid 513) not found in > </tmp/igetenv.so> > 13:52:09 (-1): ERROR: Loading Routine <sql_igetenv> procid=513 > > If I use objdump I can see the routine is exported: > > root:2:/home/rayb>objdump -T /tmp/igetenv.so > > /tmp/igetenv.so: file format elf64-x86-64 > > DYNAMIC SYMBOL TABLE: > 0000000000000428 l d .init 0000000000000000 .init > 0000000000000000 D *UND* 0000000000000000 mi_lvarchar_to_string > 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ > 0000000000000000 w D *UND* 0000000000000000 _Jv_RegisterClasses > 0000000000000000 w DF *UND* 0000000000000000 GLIBC_2.2.5 __cxa_finalize > 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 getenv > 0000000000000000 D *UND* 0000000000000000 mi_string_to_lvarchar > 000000000000055c g DF .text 0000000000000046 Base igetenv > > Can anyone help with what I am missing here? > > > > > ******************************************************************************* To post a response via email (IIUG members only): 1. Address it to ids@iiug.org 2. Include the bracketed message number in the subject line: [33569] *******************************************************************************

Viewing all articles
Browse latest Browse all 9843

Trending Articles