I've played with PostgreSql for couple weeks. Currently, I try to develop an
extension on windows system with VC++2005. I installed the full package of
PostgreSql 8.3 with include files and libraries. Compilation is ok in
vc2005, besides some warnings. But, when I tried to run my function in psql,
I always got a run time error. After I got the PostgreSql source codes, I
complied my own libpostgres.lib. And then link my code with this lib. Run
it, got the same error. I found the CurrentMemoryContext is NULL, which was
supposed to be initialized by the backend itself. Anyone could tell me what
happened here? Just because it's windows? or I should use cygwin?
I noticed CurrentMemoryContext is supposed to be imported to my dll by the
macro DLLIMPORT. It seems like PostgreSql can't send this parameter to my
Thank you for helping me!
The snippet of my codes looks like below:
void* ptr=palloc(10); // or pgport_palloc(10); error occurred here,
CurrentMemoryContext equals to NULL, NULL pointer!