Esql/C Problem.....HELP~~~
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
Hi, all, I use Informix SE on LINUX, and I found a problem. I write an easy EC program(nothing about sql) and compile it to execution file. It can run well under linux command, but if i run it on web browser, it don't work(never have output). But if I rename it to "tt.c" , and compile it to an execution file. It can run well on both linux command and the web browser. I don't know why? It is the same C program and nothing about SQL, just compiled by different C compiler. Why one can execute on web browser, and the other can't? Anyone knows? Does any parameter I need to set on linux for web? Thanks... Peary Here is my program, "tt.ec" #include <stdio.h> #include <stdlib.h> #include <string.h> void main(int argc,char *argv[]) { printf("Content-type:text/html%c%c",10,10); printf("This tests the output of C on WEB...\\n"); /*printf("%s",argv[1]);*/ return; }
peary wrote: > > Hi, all, > I use Informix SE on LINUX, and I found a problem. > > I write an easy EC program(nothing about sql) and > compile it to execution file. It can run well under linux command, > but if i run it on web browser, it don't work(never have output). > > But if I rename it to "tt.c" , and compile it to an execution file. > It can run well on both linux command and the web browser. > > I don't know why? It is the same C program and nothing about SQL, > just compiled by different C compiler. Why one can execute on web browser, > and the other can't? Curiouser and curiouser! Actually they are compiled by the SAME C compiler. Esql is just a shell script that runs the precompiler and preprocessor steps then runs the C compiler, indeed you can pass it .c files and .a files and it will skip the ESQL preprocessor and just run the C compiler for the .c files and the assembler for the .a files! Look in the esql script for the value of INFORMIXCC and see what it thinks the name of the C compiler is. It may be that you are running egcs when you compile C manually but esql is executing the value of INFORMIXCC which might be cc or gcc. You CAN modify the default in the script or set INFORMIXCC in your environment (or in /etc/profile for all environments) if this is the case. If you pass the renamed .c file to esql instead of to gcc directly then surely it should work just as it does with gcc. If not then there is surely a problem, expecially is INFORMIXCC is set to the command you are using to compile .c files. Art S. Kagel
peary wrote: > I use Informix SE on LINUX, and I found a problem. > > I write an easy EC program(nothing about sql) and > compile it to execution file. It can run well under linux command, > but if i run it on web browser, it don't work(never have output). > > But if I rename it to "tt.c" , and compile it to an execution file. > It can run well on both linux command and the web browser. > > I don't know why? It is the same C program and nothing about SQL, > just compiled by different C compiler. Why one can execute on web > browser, and the other can't? > > Anyone knows? Does any parameter I need to set on linux for web? > Thanks... > > Peary > > Here is my program, "tt.ec" > > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > void main(int argc,char *argv[]) > { > printf("Content-type:text/html%c%c",10,10); > printf("This tests the output of C on WEB...\\n"); > /*printf("%s",argv[1]);*/ > return; > } The usual answer to such questions is 'environment, environment, environment'. Since you linked with ESQL/C 7.24, you also got a file from the ESQL/C libraries linked into your code, which in turn probably causes some other ESQL/C shared libraries to be added to the program. You can tell this by running ldd on the executable and seeing which Informix libraries show up. If I'm correct (90% confident), then you need to set LD_LIBRARY_PATH or juggle with /etc/ld.so.conf. And that means rebooting the web server after adding some SetEnv or PassEnv directives. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>
I have set the LD_LIBRARY_PATH in /etc/profile and it don't work.... Did I set it to the wrong file? Where should i set LD_LIBRARY_PATH? Thank you... Peary > > The usual answer to such questions is 'environment, environment, > environment'. Since you linked with ESQL/C 7.24, you also got > a file from the ESQL/C libraries linked into your code, which in > turn probably causes some other ESQL/C shared libraries to be > added to the program. You can tell this by running ldd on the > executable and seeing which Informix libraries show up. If I'm > correct (90% confident), then you need to set LD_LIBRARY_PATH or > juggle with /etc/ld.so.conf. And that means rebooting the > web server after adding some SetEnv or PassEnv directives. > > -- > Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) > Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN > #include <disclaimer.h> >