Subject: C function

From: [email-masked] (STUDBUMS)
Date: Tue, 28 Jul 92 21:04:48 -0700

Hi,

I got an error "link failed" when I tried to define a simple C function
and use it in POSTGRES. I noticed that there was a discussion about the 
same problem sometimes ago. The suggested solution is to do the 
following:
      ld -r ..
However, the problem was still there after I tried this.  Could someone
tell me how to deal with the problem?

Another question, in the example given on page 50 of the manual. A
function GetAttributeByName() is used to get the value of an attribute,
but the result is taken differently between 'salary' and 'age', the
former is an address while the later is a value, how can I explain
this situation?

Thanks a lot.

---

From: postarch (Postgres Mailing Archive)
Date: Thu, 30 Jul 92 16:46:21 PDT

> tell me how to deal with the problem?

There are two other possibilities why this might be failing.  One is that
you may be using a function name that is already defined in postgres.  To
be safe you should prepend your name to the function name (be careful not
to exceed 16 characters).  The other possibility is that /tmp is filling
up.  Postgres is a fairly large binary and ld uses /tmp for its
intermediate files.

> former is an address while the later is a value, how can I explain

Each type instance has a boolean attribute called typbyval.  When this
is false you are dealing with pointers, otherwise you have the data in
your hands.  In general if the type length is <= sizeof (char *) it will
be 'by value'.  One exception is float4.

Jeff Meredith
[email-masked]