CurrentMemoryContext is NULL

Поиск
Список
Период
Сортировка
От Guan Wang
Тема CurrentMemoryContext is NULL
Дата
Msg-id dd5c86230707061243k1ce6dd35l7c168dea91a9278@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hi guys,<br /><br />I've played with PostgreSql for couple weeks. Currently, I try to develop an extension on windows
systemwith VC++2005. I installed the full package of PostgreSql 8.3 with include files and libraries. Compilation is ok
invc2005, besides some warnings. But, when I tried to run my function in psql, I always got a run time error. After I
gotthe PostgreSql source codes, I complied my own libpostgres.lib. And then link my code with this lib. Run it, got the
sameerror. I found the CurrentMemoryContext is NULL, which was supposed to be initialized by the backend itself. Anyone
couldtell me what happened here? Just because it's windows? or I should use cygwin? <br /><br />I noticed
CurrentMemoryContextis supposed to be imported to my dll by the macro DLLIMPORT. It seems like PostgreSql can't send
thisparameter to my dll...<br /><br />Thank you for helping me!<br /><br />The snippet of my codes looks like below:
<br/><br />#include "postgres.h"<br /><br />#include "fmgr.h"<br /><br />PG_FUNTION_INFO_V1(foobar)<br /><br />Datum
foobar(PG_FUNCTION_ARGS)<br/>{<br />    void* ptr=palloc(10); // or pgport_palloc(10); error occurred here,
CurrentMemoryContextequals to NULL, NULL pointer! <br />    return NULL;<br />}<br /> 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Still recommending daily vacuum...
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Bgwriter strategies