Re: Patch to allow C extension modules to initialize/finish

From: tomas(at)tuxteam(dot)de
To: "Ralf S(dot) Engelschall" <rse(at)engelschall(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch to allow C extension modules to initialize/finish
Date: 2006-08-03 16:22:42
Message-ID: 20060803162242.GC3539@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Aug 02, 2006 at 09:04:11PM +0200, Ralf S. Engelschall wrote:
> PostgreSQL provides a way to load C extension modules with its internal
> FMGR. Unfortunately there is no portable way for an extension module to
> initialize (directly after the pg_dlopen() of the DSO) and to finish
> (directly before the pg_dlclose() of the DSO). [...]

Cool, but...

[...]

> +
> + /* optionally give the DSO a chance to finish by calling
> + a PostgreSQL-specific (and this way portable) "_PG_fini"
> + function similar to what dlopen(3) implicitly does with
> + "_fini" on some Unix platforms. */
> + if ((PG_fini = (PG_init_t *)pg_dlsym(file_scanner->handle, "_PG_fini")) != NULL)
^^^^^^^^^
> + (*PG_fini)();
> +
> pg_dlclose(file_scanner->handle);
> free((char *) file_scanner);
> /* prv does not change */

shouldn't that be PG_fini_t?

(yeah, those nitpickers, especially those who are mostly silent
bystanders ;)

But I'd support the idea myself.

Thanks
-- tomas

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ralf S. Engelschall 2006-08-03 17:04:29 Re: Patch to allow C extension modules to initialize/finish
Previous Message Wade Klaver 2006-08-03 16:02:57 unsubscribe

Browse pgsql-hackers by date

  From Date Subject
Next Message Csaba Nagy 2006-08-03 16:33:03 Re: pg_terminate_backend
Previous Message Tom Lane 2006-08-03 16:21:55 Re: pg_terminate_backend