Compiling extension C with MingW in windows, Error...

From: Edwin Quijada <listas_quijada(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Compiling extension C with MingW in windows, Error...
Date: 2010-09-03 03:31:37
Message-ID: BAY155-w5229CC465896268939F9B8E38D0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi, I am tryng to compile a C extension in windows using Minigw but always I get the same error

C:\Program Files\PostgreSQL\8.3\share\exte_c>C:\mingw\bin\gcc -shared -o pg2.dll
pg2.o
pg2.o:pg2.c:(.text+0x86): undefined reference to `_imp__CurrentMemoryContext'
pg2.o:pg2.c:(.text+0x92): undefined reference to `MemoryContextAlloc'
collect2: ld returned 1 exit status

This error is just when it links.

Aparently this occur just when use text vardata

This is the code for my function. This function was taken from manual page but it doesnt work neither.

#include <string.h>
#include "fmgr.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

PG_FUNCTION_INFO_V1(concat_text);

Datum
concat_text(PG_FUNCTION_ARGS)
{
text *arg1 = PG_GETARG_TEXT_P(0);
text *arg2 = PG_GETARG_TEXT_P(1);
int32 new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;

text *new_text = (text *) palloc(new_text_size);

VARATT_SIZEP(new_text) = new_text_size;
//
memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ);
memcpy(VARDATA(new_text) + (VARSIZE(arg1)-VARHDRSZ),
//
VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ);
PG_RETURN_TEXT_P(new_text);
}

Any clues about this ???

*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*-------------------------------------------------------*

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2010-09-03 06:24:06 Re: On-disk size of db increased after restore
Previous Message Craig Ringer 2010-09-03 03:15:40 Re: Connection question