AYUDA con Programacion en C para PostgreSQL

From: Anthony Rafael Sotolongo Leon <asotolongo(at)uci(dot)cu>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: AYUDA con Programacion en C para PostgreSQL
Date: 2011-03-13 17:18:11
Message-ID: 204715394.89511300036691556.JavaMail.root@ucimail1.uci.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola a todos estoy tratando de iniciarme programando en C para PostgreSQL y para so estoy leyendo el manual de la 9.0 seccion 35.9. C-Language Functions , aqui les pongo el primer programa (test.c)

#include "fmgr.h"
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

int suma (int a, int b)
{
return a+b;
}

y lo compilo de modo siguiente
gcc -I /usr/local/include -c test.c
Y me da los siguientes errores (es como si la fmgr.h tuviera problemas) :

In file included from test.c:2:
fmgr.h:36: error: expected declaration specifiers or ‘...’ before ‘*’ token
fmgr.h:36: error: ‘Datum’ declared as function returning a function
fmgr.h:46: error: expected specifier-qualifier-list before ‘PGFunction’
fmgr.h:66: error: expected specifier-qualifier-list before ‘bool’
fmgr.h:76: error: expected ‘)’ before ‘functionId’
fmgr.h:83: error: expected ‘)’ before ‘functionId’
fmgr.h:90: error: expected declaration specifiers or ‘...’ before ‘MemoryContext’
fmgr.h:174: error: expected declaration specifiers or ‘...’ before ‘int32’
fmgr.h:174: error: expected declaration specifiers or ‘...’ before ‘int32’
fmgr.h:419: error: expected ‘)’ before ‘func’
fmgr.h:420: error: expected ‘)’ before ‘func’
fmgr.h:421: error: expected ‘)’ before ‘func’
fmgr.h:423: error: expected ‘)’ before ‘func’
fmgr.h:425: error: expected ‘)’ before ‘func’
fmgr.h:427: error: expected ‘)’ before ‘func’
fmgr.h:430: error: expected ‘)’ before ‘func’
fmgr.h:433: error: expected ‘)’ before ‘func’
fmgr.h:436: error: expected ‘)’ before ‘func’
fmgr.h:445: error: ‘FunctionCall1’ declared as function returning a function
fmgr.h:446: error: ‘FunctionCall2’ declared as function returning a function
fmgr.h:448: error: ‘FunctionCall3’ declared as function returning a function
fmgr.h:450: error: ‘FunctionCall4’ declared as function returning a function
fmgr.h:452: error: ‘FunctionCall5’ declared as function returning a function
fmgr.h:455: error: ‘FunctionCall6’ declared as function returning a function
fmgr.h:458: error: ‘FunctionCall7’ declared as function returning a function
fmgr.h:461: error: ‘FunctionCall8’ declared as function returning a function
fmgr.h:465: error: ‘FunctionCall9’ declared as function returning a function
fmgr.h:473: error: expected ‘)’ before ‘functionId’
fmgr.h:474: error: expected ‘)’ before ‘functionId’
fmgr.h:475: error: expected ‘)’ before ‘functionId’
fmgr.h:477: error: expected ‘)’ before ‘functionId’
fmgr.h:479: error: expected ‘)’ before ‘functionId’
fmgr.h:481: error: expected ‘)’ before ‘functionId’
fmgr.h:484: error: expected ‘)’ before ‘functionId’
fmgr.h:487: error: expected ‘)’ before ‘functionId’
fmgr.h:490: error: expected ‘)’ before ‘functionId’
fmgr.h:497: error: expected declaration specifiers or ‘...’ before ‘Oid’
fmgr.h:497: error: expected declaration specifiers or ‘...’ before ‘int32’
fmgr.h:497: error: ‘InputFunctionCall’ declared as function returning a function
fmgr.h:498: error: expected ‘)’ before ‘functionId’
fmgr.h:501: error: expected ‘)’ before ‘functionId’
fmgr.h:503: error: expected declaration specifiers or ‘...’ before ‘Oid’
fmgr.h:503: error: expected declaration specifiers or ‘...’ before ‘int32’
fmgr.h:503: error: ‘ReceiveFunctionCall’ declared as function returning a function
fmgr.h:504: error: expected ‘)’ before ‘functionId’
fmgr.h:506: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
fmgr.h:507: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
fmgr.h:515: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fmgr_internal_function’
fmgr.h:516: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_fn_expr_rettype’
fmgr.h:517: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_fn_expr_argtype’
fmgr.h:518: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_call_expr_argtype’
fmgr.h:519: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_fn_expr_arg_stable’
fmgr.h:520: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_call_expr_arg_stable’
fmgr.h:527: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘load_external_function’
fmgr.h:529: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lookup_external_function’
fmgr.h:530: error: expected declaration specifiers or ‘...’ before ‘bool’
fmgr.h:545: error: expected declaration specifiers or ‘...’ before ‘MemoryContext’
fmgr.h:561: error: expected ‘)’ before ‘procedureId’
test.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘const’
test.c: In function ‘Pg_magic_func’:
test.c:4: error: ‘PG_VERSION_NUM’ undeclared (first use in this function)
test.c:4: error: (Each undeclared identifier is reported only once
test.c:4: error: for each function it appears in.)
test.c:4: error: ‘FUNC_MAX_ARGS’ undeclared (first use in this function)
test.c:4: error: ‘INDEX_MAX_KEYS’ undeclared (first use in this function)
test.c:4: error: ‘NAMEDATALEN’ undeclared (first use in this function)
test.c:4: error: ‘FLOAT4PASSBYVAL’ undeclared (first use in this function)
test.c:4: error: ‘FLOAT8PASSBYVAL’ undeclared (first use in this function)

Alguna ayuda por favor (aclarcion, ejemplo, etc.)
GRACIAS!!!

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2011-03-14 04:45:19 Re: sobre transancaciones
Previous Message Henry 2011-03-12 16:46:51 Re: funcion y enable_sort,enable_seq_scan