Fw: Re: C-procedure crashed in Postgres 8.3.3 when using 'text'variable (WinXP) - additional

Started by el doradoover 17 years ago1 messagesgeneral
Jump to latest
#1el dorado
do_ra_do@mail.ru

Yes, I use a Microsoft Visual Studio compiler, but the full version - not Express Edition. Just in case I quote the code again ( it's short):

----------------------------------------------------------------------
include "postgres.h"
#include "fmgr.h"
#include "executor/executor.h"
#include "utils/timestamp.h"
#include "utils/builtins.h"
#include "utils/formatting.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

#define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(cstrp)))

PG_FUNCTION_INFO_V1(getTimeFromApplication);
Datum
getTimeFromApplication(PG_FUNCTION_ARGS)
{
PG_RETURN_TEXT_P(GET_TEXT("success"));
}
----------------------------------------------------------------------
Preprocessor definitions:WIN32;_DEBUG;_WINDOWS;_USRDLL;C_SYNCTIME_EXPORTS
Postgres 8.3.3 (standard binaries - so built by means of MSVC), WinXP SP2.
Error while using the function in PG - invalid memory alloc request size 4294967293

It seems to me I must change some other options in Configuration Properties - but I can't guess what exactly...
Or maybe I should use Visual Studio 2005 Express Edition necessarily?

Redards, Marina.

Show quoted text

el dorado wrote:

Hello.
Thank you very much for your answer.

1>d:\pgsql83\getstring\c_getstring.c(10) : warning C4273: 'Pg_magic_func' : inconsistent dll linkage
1> d:\pgsql83\getstring\c_getstring.c(10) : see previous definition of 'Pg_magic_func'

This should be a big red flag to you. It suggests that you have issues
with __declspec(dllimport) and __declspec(dllexport) annotations.

It looks like you are using a Microsoft Visual Studio compiler. If you
are using Visual Studio 2005 Express Edition you must modify the
project's preprocessor definitions to set the WIN32 macro, as 2005
Express Edition does not do so by default. See earlier discussion in the
archives from a few months ago.

Alternately, modify the definition of the default win32 project to set
the right macros, then create a new project.

This issue does NOT affect the full version, only the Express edition.
It also does not affect 2008 Express Edition. I've just reproduced it on
a clean install of Windows and the Express Edition.

--
Craig Ringer