[GSOC] questions about idea "rewrite pg_dump as library" - Mailing list pgsql-hackers

From
Subject [GSOC] questions about idea "rewrite pg_dump as library"
Date
Msg-id 71e01949.2e16b.13df4707405.Coremail.shuai900217@126.com
Whole thread Raw
Responses Re: [GSOC] questions about idea "rewrite pg_dump as library"
Re: [GSOC] questions about idea "rewrite pg_dump as library"
List pgsql-hackers
<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hi all, <br /><div class="moz-text-html"
lang="x-western"><divclass="moz-forward-container">     I'd like to introduce myself to the dev community. I am Shuai
Fan,a student from Dalian University of Technology, DLUT , for short, China. And I am interested in working with
PostgreSQLproject in GSOC2013.<br />     I'm interested in the idea "Rewrite (add) pg_dump and pg_restore utilities as
libraries(.so, .dll & .dylib)".<span style="color: rgb(0, 0,         0); font-family: sans-serif; font-size: 13px;
font-style:        normal; font-variant: normal; font-weight: normal;         letter-spacing: normal; line-height:
19px;orphans: 2;         text-align: -webkit-auto; text-indent: 0px; text-transform:         none; white-space: normal;
widows:2; word-spacing: 0px;         -webkit-text-size-adjust: auto; -webkit-text-stroke-width:         0px;
background-color:rgb(255, 255, 255); display: inline         !important; float: none; "> </span><br /><br />     These
days,I had a talk with Mr. Pavel Golub by email, the author of this post. And asked some questions about this idea. He
advicedme to post the question to this mail list. <br /><br />     My question is:<br />     There are lots of
functionsin "pg_dump.c". If I rewrite this file as library. I should split "pg_dump.c" into two or more files(Mr. Pavel
Golub'sadvice). However, some functions, do have return value. e.g. <br /><br />     static DumpableObject
*createBoundaryObjects(void);<br/><br />     I thought, these functions must get return value through function argument
bypassing pointer to it, when using library. But, the question is: If I did so, function prototype may be changed. And
Mr.Pavel Golub said "it's better to keep all functions with the same declaration", and so "we will only have one code
basefor both console application and library". I think he is right. <br />     But then, how can I deal with this
situation?From my point of view, I can't malloc a variable (e.g. DumpableObject) in one library (e.g. pg_dumplib.so),
andthen return it's pointer to another library (or excutable program). Maybe, it's not safe(?). Or has something to do
with"memory leak"(?). I'm not sure.<br />     <br />     Do you have any suggestions?<br /><br /><br /> Best wishes,<br
/>    Shuai<br /></div></div></div><br /><br /><span title="neteasefooter"><span
id="netease_mail_footer"></span></span>

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [BUGS] replication_timeout not effective
Next
From: Dang Minh Huong
Date:
Subject: Re: [BUGS] replication_timeout not effective