Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA22211; Thu, 9 Jul 92 07:21:32 -0700
Message-Id: <9207091421.AA22211@postgres.Berkeley.EDU>
From: young@kdb.snu.ac.kr (Young Tae Lee)
Subject: no subject (file transmission)
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
To: postgres@postgres.Berkeley.EDU
Date: Thu, 9 Jul 92 23:29:34 KDT
X-Mailer: ELM [version 2.3h1 PL11]

I was the graduate student of Dept. of Control & Instru. ,Seoul National University in Korea.
Some days ago, while I was developing simple application program using POSTGRES.I had difficulty with loading the file to the backends. I am sorry to bother you but
please tell me the mechanism that POSTGRES loads and links the object file.


I defined C function as fillowing.

  define function window(language="c",returntype=int4)
  arg is (char16) as "/user/people/young/window.o" \g

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 <X11/Xlib.h>
  # include <X11/Xutil.h>

  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);
  }

In this program, I tried to get simple window by using side effect but I failed.Can't the backends link the program object code with Xlib?

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 spite 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 <stdio.h>
int win()
{
  FILE *fp;
  
  fp=fopen("user/people/young/test","w");
  printf("I am a student");
  return(1);
}


> cc -c win1.c
> monitor fms
Welcome to the C POSTGRES terminal monitor

Go 
* define function win(language="c",returntype=int4)
arg is (motor) as "/user/people/young/win1.o"\g

Query sent to backend is "define function win(language="c",returntype=int4) arg is (motor) as "/user/people/young/win1.o""
DEFINE
Go 
* load "/user/people/young/win1.o"\g

Query sent to backend is "load "/user/people/young/win1.o""
LOAD
Go 
* retrieve (a=win(motor)) where motor.name="CAP60"\g

Query sent to backend is "retrieve (a=win(motor)) where motor.name="CAP60""
---------------
| a           |
---------------
| 1           |
---------------







