Re: Free Pascal and Postgresql Functions, Possible? - Mailing list pgsql-general

From Tom Lane
Subject Re: Free Pascal and Postgresql Functions, Possible?
Date
Msg-id 2603.1134429016@sss.pgh.pa.us
Whole thread Raw
In response to Re: Free Pascal and Postgresql Functions, Possible?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Mon, Dec 12, 2005 at 08:43:52AM -0600, Tony Caduto wrote:
>> Is there any special C headers (for creating functions that return
>> results?) that are PG specific that would need to be ported to Pascal?

> Well, I don't know about any special C headers. The examples in the
> documentation tell you what you need for various features. However, I
> think the most important header would be fmgr.h since that is how the C
> functions get arguments from and return data to the server. With a few
> declarations for things like palloc you should be able to do most
> things.

It'd depend hugely on what you want to accomplish.  For a self-contained
computational function that you don't mind using "version 0" call
convention for, you might not need any headers at all, just write the
thing as a regular cdecl function.  The next steps up would be access to
palloc (so you could return pass-by-reference datatypes), elog (for
error reporting), and fmgr.h (so you could use version-1 call
convention, which is more portable than version-0 and can deal with
NULLs).  If you wanted to do stuff that involved poking into the
backend's internal data structures, I think by far the path of least
resistance is to forget Pascal and use C ...

            tom "hacked Pascal in the '70s" lane

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: What's new in 8.1.1
Next
From: Tom Lane
Date:
Subject: Re: Excessive vacuum times