Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id F04586343E0 for ; Mon, 6 Apr 2009 10:36:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 77729-05 for ; Mon, 6 Apr 2009 10:36:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f176.google.com (mail-gx0-f176.google.com [209.85.217.176]) by mail.postgresql.org (Postfix) with ESMTP id 43B306324C2 for ; Mon, 6 Apr 2009 10:36:51 -0300 (ADT) Received: by gxk24 with SMTP id 24so6326588gxk.19 for ; Mon, 06 Apr 2009 06:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=KdoEZicT9VlbOhBD358v89zJhkUtsyisjh8C9zt0nd0=; b=CMif3JMEUep+4/cHI6DYqPu1ujIyJH3isgtTEZcbI/NIXafACL3/W4JgYeQlJJiUgq taTYqeR43PsnKtUMI2hEB/k5PquJj7Dhxh1dAIOrOoyl4TG09dIcj2B1Zxm4q4QesS3H YPiikwvJAhS28HmapX3Hnf6xOI4m2C0Fv2B0g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=T+QNv3A5ql3FOOsaIOKhchZskYWPyTVYuT+ALjab5knxxxQhJ317jNNIL+Sh0XilD8 +sJXdrMaG+FeykCKlKJl+HcBfyPimLU8tL0qPDwtvHaMLSyHLVJtb6YiUob8NPWe9lVx Wt1DtmXCnpj1V5NLekD/UUfRS4T+gPPj0QcvY= MIME-Version: 1.0 Received: by 10.151.100.17 with SMTP id c17mr8433887ybm.216.1239025009721; Mon, 06 Apr 2009 06:36:49 -0700 (PDT) In-Reply-To: References: Date: Mon, 6 Apr 2009 10:36:49 -0300 Message-ID: Subject: Re: [COMMITTERS] From: Emanuel Calvo Franco To: eehab hamzeh , General PostgreSQL List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/186 X-Sequence-Number: 146142 2009/4/6 eehab hamzeh : > here are the code and the error , i compile them using vc++ 6 and VC++ 20= 08 > and minGW the example below are for minGW > THANKS > > #include "postgres.h" > #include > #include "fmgr.h" > > #ifdef PG_MODULE_MAGIC > PG_MODULE_MAGIC; > #endif > > /* by value */ > > PG_FUNCTION_INFO_V1(add_one); > > Datum > add_one(PG_FUNCTION_ARGS) > { > =A0 =A0 int32 =A0 arg =3D PG_GETARG_INT32(0); > > =A0 =A0 PG_RETURN_INT32(arg + 1); > } > > /* by reference, fixed length */ > > PG_FUNCTION_INFO_V1(add_one_float8); > > Datum > add_one_float8(PG_FUNCTION_ARGS) > { > =A0 =A0 /* The macros for FLOAT8 hide its pass-by-reference nature. */ > =A0 =A0 float8 =A0 arg =3D PG_GETARG_FLOAT8(0); > > =A0 =A0 PG_RETURN_FLOAT8(arg + 1.0); > } > > PG_FUNCTION_INFO_V1(makepoint); > > Datum > makepoint(PG_FUNCTION_ARGS) > { > =A0 =A0 /* Here, the pass-by-reference nature of Point is not hidden. */ > =A0 =A0 Point =A0 =A0 *pointx =3D PG_GETARG_POINT_P(0); > =A0 =A0 Point =A0 =A0 *pointy =3D PG_GETARG_POINT_P(1); > =A0 =A0 Point =A0 =A0 *new_point =3D (Point *) palloc(sizeof(Point)); > > =A0 =A0 new_point->x =3D pointx->x; > =A0 =A0 new_point->y =3D pointy->y; > > =A0 =A0 PG_RETURN_POINT_P(new_point); > } > > /* by reference, variable length */ > > PG_FUNCTION_INFO_V1(copytext); > > Datum > copytext(PG_FUNCTION_ARGS) > { > =A0 =A0 text =A0 =A0 *t =3D PG_GETARG_TEXT_P(0); > =A0 =A0 /* > =A0 =A0 =A0* VARSIZE is the total size of the struct in bytes. > =A0 =A0 =A0*/ > =A0 =A0 text =A0 =A0 *new_t =3D (text *) palloc(VARSIZE(t)); > =A0 =A0 VARATT_SIZEP(new_t) =3D VARSIZE(t); > =A0 =A0 /* > =A0 =A0 =A0* VARDATA is a pointer to the data region of the struct. > =A0 =A0 =A0*/ > =A0 =A0 memcpy((void *) VARDATA(new_t), /* destination */ > =A0 =A0 =A0 =A0 =A0 =A0(void *) VARDATA(t), =A0 =A0 /* source */ > =A0 =A0 =A0 =A0 =A0 =A0VARSIZE(t)-VARHDRSZ); =A0 =A0/* how many bytes */ > =A0 =A0 PG_RETURN_TEXT_P(new_t); > } > > PG_FUNCTION_INFO_V1(concat_text); > > Datum > concat_text(PG_FUNCTION_ARGS) > { > =A0 =A0 text =A0*arg1 =3D PG_GETARG_TEXT_P(0); > =A0 =A0 text =A0*arg2 =3D PG_GETARG_TEXT_P(1); > =A0 =A0 int32 new_text_size =3D VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ; > =A0 =A0 text *new_text =3D (text *) palloc(new_text_size); > > =A0 =A0 VARATT_SIZEP(new_text) =3D new_text_size; > =A0 =A0 memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ); > =A0 =A0 memcpy(VARDATA(new_text) + (VARSIZE(arg1)-VARHDRSZ), > =A0 =A0 =A0 =A0 =A0 =A0VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ); > =A0 =A0 PG_RETURN_TEXT_P(new_text); > } > > > the error > > in function 'makepoint': > error: 'Point' undeclared (first use in this function) > error: (each undeclared identifier is reported only one > error: for each function it appears in.) > error: 'pointx' undeclared (first use in =B4this function) > error: 'pointy' undeclared (first use in his fnction) > error 'new_point' undeclared (first use in his function) > error: syntax error befre ')' oken > in function 'copy text': > error: 'invalid lvalue in assinment > In function 'concat_text' > error: invalid lvalue in assignement > warning no new line at end of file > > Please any direction of how to solve the problem > > thanks > > You aren't including the path of the libs when you compiling (option -I). don't send to comitters please, send into pgsql-general. Thanks. --=20 Emanuel Calvo Franco Sumate al ARPUG ! (www.postgres-arg.org - www.arpug.com.ar) ArPUG / AOSUG Member Postgresql Support & Admin