Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: Custom C fu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 23 Topic 15452 of 16554
Post > Topic >>

Re: Custom C function - is palloc broken?

by craig@[EMAIL PROTECTED] (Craig Ringer) May 5, 2008 at 05:53 AM

Dan "Heron" Myers wrote:
> Craig Ringer wrote:
>  > Can you send me a complete, compileable example that illustrates the
>  > problem, along with instructions on how to reproduce it? If possible,
>  > send a compiled binary and any dependencies too. I'm curious to see
if
>  > this is in fact shared library issues.
> 

> Then I used the following SELECT statement:
> 
> SELECT copytext(colname) FROM tablename;
> 
> where "colname" is a text column in table "tablename".  This statement 
> crashes the database server.

I'm certainly seeing a server crash with your DLL.

I've built the example with Visual C++ 9 (I had a to make a couple of 
changes, such as defining BUILDING_DLL and ex****ting the `copytext' 
function with PGDLLIM****T) and I get a backend crash with that too. Of 
course, that's also using a different runtime, and it's far from 
impossible that I'm doing something wrong in the build process.

I'm having some trouble getting the example building under Visual Studio 
Express 2005 ( I had to install it to test, and it's *much* uglier than 
2008 ) so I haven't been able to test it properly with a matching runtime.

Looking at Pg's headers, though, I'm going to say that my first guess 
about mismatched runtimes is probably wrong. That's often the cause of 
plugin/extension problems on win32, but I'm not sure I see what would be 
causing a mismatched runtime related failure here. Not with memory 
handling, anyway. palloc() is a macro, but it's implemented using 
ex****ted functions from the backend, so allocations are actually being 
performed with the backend's runtime. No memory appears to be being 
freed in the example code, only being handed over to the backend to be 
released later.

I'll see if it works when built with VC++ Express 2005 if I can get it 
to behave (ie if/when I figure out what stupid thing I've done). I'm not 
too sure that'll actually be the issue though.

> Your theory could very well be true - especially if the issue is with a 
> different version of gettext.  MinGW's website's snapshot is from 2006 
> or something, so it wouldn't surprise me if Postgres uses a newer
version.

I assume you needed gettext because PostgreSQL's headers expose Pg's use 
of libintl to users of the Pg headers, so you needed libintl.h?

As the standard win32 build of Pg is built with gettext, but does not 
****p the headers for the version of gettext used, it's a bit tricky to 
build external C functions etc. It'd be nice to bundle those headers or 
avoid including libintl.h and friends from Pg headers that're likely to 
be needed for external C functions.

Ideally only .c sources would include libintl.h where required (but I 
know how practical *that* sometimes turns out to be - 
*cough*Freetype*cough*).

--
Craig Ringer

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 23 Posts in Topic:
Custom C function - is palloc broken?
n8thatcher@[EMAIL PROTECT  2008-05-03 21:39:04 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-04 23:50:26 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-04 23:52:41 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-04 13:02:49 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 05:53:27 
Re: Custom C function - is palloc broken?
magnus@[EMAIL PROTECTED]   2008-05-04 21:15:49 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 06:47:11 
Re: Custom C function - is palloc broken?
n8thatcher@[EMAIL PROTECT  2008-05-04 21:53:01 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 15:54:13 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 09:26:22 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 16:57:08 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 18:47:50 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 08:42:16 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 19:42:01 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 10:19:32 
Re: Custom C function - is palloc broken?
tgl@[EMAIL PROTECTED] (T  2008-05-05 22:32:11 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 12:02:28 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 20:45:05 
Re: Custom C function - is palloc broken?
jd@[EMAIL PROTECTED] (&q  2008-05-05 20:18:42 
Re: Custom C function - is palloc broken?
tgl@[EMAIL PROTECTED] (T  2008-05-05 22:22:43 
Re: Custom C function - is palloc broken?
magnus@[EMAIL PROTECTED]   2008-05-05 09:07:37 
Re: Custom C function - is palloc broken?
dpage@[EMAIL PROTECTED]   2008-05-06 09:46:14 
Re: Custom C function - is palloc broken?
dpage@[EMAIL PROTECTED]   2008-05-06 09:48:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 1:35:47 CDT 2008.