pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Louise Catherine <r1c4n@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Make C file for create type
Date: Fri, 5 Aug 2005 01:51:18 -0700 (PDT)
Message-ID: <20050805085118.98162.qmail@web33411.mail.mud.yahoo.com> (raw)

Hallo,
I found a problem making new data type kata,expecially
when make the C file ,can anyone help me solve it. 

This error occur when I'm compiling the C file :
/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../crt1.o(.text+0x18):
In function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to
`main'
collect2: ld returned 1 exit status

Here it's my code :
file3.c
-------
#include "postgres.h"

typedef struct kata
{
  char kt[30];
} kata;

kata *input_kata(char *str);
char *output_kata(kata * kata);

kata *
input_kata(char *str)
{
    char kt[30];
    kata *result;

    if (sscanf(str, "( %s )", &kt) !=1)
    {
        printf ("error\n");
	return NULL;
    }

    result = (kata *) malloc(sizeof(kata));
    strcpy(result->kt,kt);
    return result;
}

char *
output_kata(kata * kata)
{
	char kt[30];
        char *result;

        strcpy(kt,kata->kt);

	if (strcmp(kt,NULL))
		return NULL;

	result = (char *) malloc(60);
	sprintf(result, "(%s)", kata->kt);
	return result;
}

kata.sql
--------
CREATE FUNCTION input_kata(cstring)
   RETURNS kata
   AS '_OBJWD_/file3'
   LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION output_kata(kata)
   RETURNS cstring
   AS '_OBJWD_/file3'
   LANGUAGE C IMMUTABLE STRICT;

CREATE TYPE kata (
    INPUT = input_kata,
    OUTPUT = output_kata
)




		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



view thread (2+ messages)  latest in thread

Message-ID: <20050805085118.98162.qmail@web33411.mail.mud.yahoo.com>
Permalink:  ../20050805085118.98162.qmail@web33411.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20050805085118.98162.qmail@web33411.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: r1c4n@yahoo.com
  Subject: Re: Make C file for create type
  In-Reply-To: <20050805085118.98162.qmail@web33411.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox