C UDR Routines on HPUX 11.11
Posted in 2006
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design
Hi, I'm trying to compile a c-based routine against a IBM Informix Dynamic Server Version 9.40.FC5 I'm trying to compile the route with gcc -Wall -shared -DMISERVBUILD -fPIC -I$INFORMIXDIR/incl/public -I$INFORMIXDIR/incl/esql -I$INFORMIXDIR/incl -c reverse.c -o reverse.o ld -dy -G -dynamic -o reverse.bld reverse.o I'm getting: rm: reverse.bld non-existent ld: (Warning) At least one PA 2.0 object file (reverse.o) was detected. The linked output may not run on a PA 1.x system. ld: Unsatisfied symbols: mi_lvarchar_to_string (code) mi_free (code) mi_alloc (code) mi_string_to_lvarchar (code) mi_get_varlen (code) ld: No $UNWIND_END$ subspace has been defined (probably missing /usr/ccs/lib/crt0.o) So it looks like that compiling is OK. But linking won't work. Regards, Bart The Routine is: //----------------------- #include <stdio.h> #include <mi.h> #include <ctype.h> mi_lvarchar *reverse(mi_lvarchar *str, MI_FPARAM *fparam) { int i,n; char *buff; mi_lvarchar *str_o; n=mi_get_varlen(str); buff=(char *)mi_alloc((n+1)*sizeof(char)); buff=(char *)mi_lvarchar_to_string(str); for (i=0;i<(n>>1);i++) { char c; c = *(buff+i); *(buff+i) = *(buff+n-1-i); *(buff+n-1-i) = c; } str_o=mi_string_to_lvarchar(buff); mi_free(buff); return (str_o); } //-----------------------
On Tue, 2006-03-28 at 08:49, Bart Huls wrote: > Hi, > > I'm trying to compile a c-based routine against a IBM Informix Dynamic > Server Version 9.40.FC5 > > I'm trying to compile the route with > gcc -Wall -shared -DMISERVBUILD -fPIC -I$INFORMIXDIR/incl/public -I$INFORMIXDIR/incl/esql > -I$INFORMIXDIR/incl -c reverse.c -o reverse.o > > ld -dy -G -dynamic -o reverse.bld reverse.o > > I'm getting: > rm: reverse.bld non-existent > ld: (Warning) At least one PA 2.0 object file (reverse.o) was detected. The > linked output may not run on a PA 1.x system. > ld: Unsatisfied symbols: > mi_lvarchar_to_string (code) > mi_free (code) > mi_alloc (code) > mi_string_to_lvarchar (code) > mi_get_varlen (code) Looks like you are missing the library that defines the above - you need to supply that on the command line as well. > ld: No $UNWIND_END$ subspace has been defined (probably missing > /usr/ccs/lib/crt0.o) > > So it looks like that compiling is OK. But linking won't work. > > Regards, > > Bart > > > > The Routine is: > //----------------------- > #include <stdio.h> > #include <mi.h> > #include <ctype.h> > > mi_lvarchar *reverse(mi_lvarchar *str, MI_FPARAM *fparam) > { > int i,n; > char *buff; > mi_lvarchar *str_o; > > n=mi_get_varlen(str); > > buff=(char *)mi_alloc((n+1)*sizeof(char)); > > buff=(char *)mi_lvarchar_to_string(str); > > for (i=0;i<(n>>1);i++) > { > char c; > c = *(buff+i); > *(buff+i) = *(buff+n-1-i); > *(buff+n-1-i) = c; > } > > str_o=mi_string_to_lvarchar(buff); > > mi_free(buff); > > return (str_o); > } > //----------------------- > > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list -- This e-mail is sponsored by http://www.integration-house.com/
Hi Jonathan, Can you point me out how and which libraries I must use because I can't seem to find them. Regards, Bart
Ok... It works now... gcc reverse.c -I$INFORMIXDIR/incl/public -I$INFORMIXDIR/incl/esql -I$INFORMIXDIR/incl -I$INFORMIXDIR/lib/dmi -L$INFORMIXDIR/lib -L$INFORMIXDIR/lib/dmi -shared -o reverse.so