C function problem
Posted in 1999
Topics: General Discussion
Hello I have made a C function that takes an argument string and returns a converted string. I have compiled and linked the function to a shared object (a .so file). I declared the function using the DECLARE FUNCTION statement and now I want to use this function in informix using 'execute function xxxx (parameter);'. The function executes, but it returns nothing. Informix comes up with an error 'Bad UDR return pointer', so I guess I am doing something wrong within the C function (which returns a pointer to the result string). I have run out of ideas by now....can anyone help me here, or give me some examples of using C functions with Informix. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Hello Rene, You must use mi_lvarchar *. In your function you have to allocate the memory space with mi_malloc function, refere the manual. Handling the strings use string function from the Informix API, be careful with C routines. Use the Datablade Developer Kit to create UDR's it is confortable. You will find samples in the Developer Network at http://www.informix.com/idn rene@ibw.nl wrote: > Hello > > I have made a C function that takes an argument string and returns a > converted string. I have compiled and linked the function to a shared object > (a .so file). I declared the function using the DECLARE FUNCTION statement > and now I want to use this function in informix using 'execute function xxxx > (parameter);'. The function executes, but it returns nothing. Informix comes > up with an error 'Bad UDR return pointer', so I guess I am doing something > wrong within the C function (which returns a pointer to the result string). I > have run out of ideas by now....can anyone help me here, or give me some > examples of using C functions with Informix. > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own -- TECOPLAN AG - Digital Mockup Technology Uwe Sick (mailto:Uwe.Sick@tecoplan.de) D-85521 Munich/Ottobrunn (Germany), Otto-Hahn-Str. 40 Voice: +49 89 608762-0, Fax: +49 89 608762-18, http://www.tecoplan.de/ (Headquarters) http://www.tecoplan.com/ (USA) --------------------------------------------------------------------------- news..... news..... news..... news..... news..... news..... news..... --------------------------------------------------------------------------- A Happy New Year from the Digital Mockup Company ---------------------------------------------------------------------------