Return-Path: postarch Received: by postgres.Berkeley.EDU (5.61/1.29) id AA09890; Tue, 21 Jul 92 09:59:39 -0700 Message-Id: <9207211659.AA09890@postgres.Berkeley.EDU> From: postarch (Postgres Mailing Archive) Subject: Re: side effect To: postgres@postgres.berkeley.edu Sender: pg_adm@postgres.berkeley.edu Reply-To: mer@postgres.berkeley.edu In-Reply-To: Your message of "Thu, 09 Jul 92 23:36:09 +0700." <9207091427.AA22234@postgres.Berkeley.EDU> Date: Tue, 21 Jul 92 09:59:32 PDT you write: > Then I tried to load the file "window.o" as following. > > load "/user/people/young/window.o" \g > > But I failed, and there was a error message "link failed" > > The source code "window.c" is as following. > > # include > # include > > int disp(in) > > char *in; > { > Display *d; > Window w; > > d=XOpenDisplay(NULL); > w=XCreateSimpleWindow(d,DefaultRootWindow(d),50,50,400,300,2,BlackPixel(d +,0),WhitePixel(d,0)); > XMapWindow(d,w); > XFlush(d); > > return(1); > } The answers to these questions have been tossed around on the post_questions alias, I'm now broadcasting the final conclusions. | When Postgres loads an object file, it links it against itself, the standard | C runtime library and the C math library. Other links must be done by the | user before Postgres attempts the load - doing a preliminary load with "ld -r" | and having postgres load *that* file should be enough, although I've never | tried this. > Also, I programmed another simple example using side effect. > In this program, I wanted the backends to print the string in the screen and +create file "test" in "user/people/young" , but the backends did not in spit +e of no error in compiling and loading to the backends. > Do you know the reason? If you know, please mail to me sooner or later. > The source code is as follows. > > > > more win1.c > # include > int win() > { > FILE *fp; > > fp=fopen("user/people/young/test","w"); > printf("I am a student"); return(1); > } | When running postgres under the postmaster stdin and stdout are closed | (we use up file descriptors like they are going out of style). If you | want to print something in the front-end you should use elog(NOTICE, "msg"); | You will have to include "utils/log.h" to get the definition of NOTICE. Jeff Meredith mer@postgres.berkeley.edu