Re: Free Pascal and Postgresql Functions, Possible?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Tony Caduto <tony(dot)caduto(at)amsoftwaredesign(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Free Pascal and Postgresql Functions, Possible?
Date: 2005-12-12 23:10:16
Message-ID: 2603.1134429016@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2005-12-12 23:10:31 Re: What's new in 8.1.1
Previous Message Tony Caduto 2005-12-12 23:04:01 What's new in 8.1.1