Re: Weird problems with C extension and bytea as input type - Mailing list pgsql-general

From Tom Lane
Subject Re: Weird problems with C extension and bytea as input type
Date
Msg-id 25771.1300889298@sss.pgh.pa.us
Whole thread Raw
In response to Re: Weird problems with C extension and bytea as input type  (Adrian Schreyer <ams214@cam.ac.uk>)
List pgsql-general
Adrian Schreyer <ams214@cam.ac.uk> writes:
> The actual C++ function looks roughly like this

> extern "C"
> char *function(bytea *b)
> {
>    string ism;
>    [...]
>    return ism.c_str();
> }

My C++ is pretty rusty, but is the pointer returned by c_str() still
valid after the string variable goes out of scope?  I'm wondering if you
need a pstrdup before returning.

            regards, tom lane

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Weird problems with C extension and bytea as input type
Next
From: Merlin Moncure
Date:
Subject: Re: RAID 1 - drive failed - very slow queries even after drive replaced