PG_MODULE_MAGIC check in 8.2
Could someone give me some general hints as to what modifications I'd need to make in the 8.2 source tree in order to remove the PG_MODULE_MAGIC requirement for loading shared libraries into the backend? Is there any chance this could be made into a configurable option so the user can choose the desired behavior?
Regards,
Shelby Cain
On Tue, Nov 14, 2006 at 02:46:41PM -0800, Shelby Cain wrote:
Could someone give me some general hints as to what modifications I'd
need to make in the 8.2 source tree in order to remove the
PG_MODULE_MAGIC requirement for loading shared libraries into the
backend? Is there any chance this could be made into a configurable
option so the user can choose the desired behavior?
Why? It's a one line addition to the source of the module, much less
work than trying to disable the check in the backend...
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
From each according to his ability. To each according to his ability to litigate.
You are assuming I have the source for the library and although I've asked nicely via email Microsoft hasn't responded to my requests for the source code to kernel32.dll. ;)
Regardless, even if I had the source, adding PG_MODULE_MAGIC to an arbitrary dll that has no need to know anything about the internals of Postgresql comes at a cost of much more than a one line to the source. It requires having all the random bits of developer headers/libraries/etc from Postgresql which has been been properly set up to work with my particular compiler environment. In this case, my initial attempts to wrap the functions in a shared library that I can control using the headers supplied with the beta3 installer have met with little success under cygwin using -mno-cygwin (which, in theory, should invoke mingw) and MSVC due to strange desires to include things like strings.h, libintl.h and various other files that don't exist.
I have an 8.1 database that has a few functions that utilize of a couple of api calls to kernel32 and another library. I'd just like to get it working under 8.2 with minimal hassle and I'll work out the long term solution of writing a proper module that wraps the calls later. Since I am familiar with building Postgresql from source that is something I'd much rather do after removing the check for a short-term solution.
Regards,
Shelby Cain
----- Original Message ----
From: Martijn van Oosterhout <kleptog@svana.org>
To: Shelby Cain <alyandon@yahoo.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Sent: Tuesday, November 14, 2006 5:23:58 PM
Subject: Re: [GENERAL] PG_MODULE_MAGIC check in 8.2
On Tue, Nov 14, 2006 at 02:46:41PM -0800, Shelby Cain wrote:
Could someone give me some general hints as to what modifications I'd
need to make in the 8.2 source tree in order to remove the
PG_MODULE_MAGIC requirement for loading shared libraries into the
backend? Is there any chance this could be made into a configurable
option so the user can choose the desired behavior?
Why? It's a one line addition to the source of the module, much less
work than trying to disable the check in the backend...
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
From each according to his ability. To each according to his ability to litigate.
Import Notes
Resolved by subject fallback
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
solves your problem
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/
On Tue, Nov 14, 2006 at 04:29:05PM -0800, Shelby Cain wrote:
You are assuming I have the source for the library and although I've
asked nicely via email Microsoft hasn't responded to my requests for
the source code to kernel32.dll. ;)
I see, you're doing something rather unsupported...
Regardless, even if I had the source, adding PG_MODULE_MAGIC to an
arbitrary dll that has no need to know anything about the internals
of Postgresql comes at a cost of much more than a one line to the
source. It requires having all the random bits of developer
headers/libraries/etc from Postgresql which has been been properly
set up to work with my particular compiler environment. In this
case, my initial attempts to wrap the functions in a shared library
that I can control using the headers supplied with the beta3
installer have met with little success under cygwin using -mno-cygwin
(which, in theory, should invoke mingw) and MSVC due to strange
desires to include things like strings.h, libintl.h and various other
files that don't exist.
I can't remember exactly, but if you search the source for the error
message you'll find the code.
That said, do you have to specify the library kernel32? If you use
language "internal", doesn't that find it since it's already loaded?
Then you don't need any module magic at all...
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
From each according to his ability. To each according to his ability to litigate.
I hadn't considered that. Thanks.
Regards,
Shelby Cain
----- Original Message ----
From: Martijn van Oosterhout <kleptog@svana.org>
To: Shelby Cain <alyandon@yahoo.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Sent: Wednesday, November 15, 2006 1:15:02 AM
Subject: Re: [GENERAL] PG_MODULE_MAGIC check in 8.2
That said, do you have to specify the library kernel32? If you use
language "internal", doesn't that find it since it's already loaded?
Then you don't need any module magic at all...
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
From each according to his ability. To each according to his ability to litigate.
____________________________________________________________________________________
Sponsored Link
Mortgage rates near 39yr lows.
$310k for $999/mo. Calculate new payment!
www.LowerMyBills.com/lre
Import Notes
Resolved by subject fallback
Martijn van Oosterhout <kleptog@svana.org> writes:
That said, do you have to specify the library kernel32? If you use
language "internal", doesn't that find it since it's already loaded?
This has come up before:
http://archives.postgresql.org/pgsql-hackers/2006-06/msg00721.php
That particular thread died off when we realized that the complained-of
usage never worked anyway. But we didn't thoroughly discuss the
question of whether there are any significant cases where it makes sense
to be able to LOAD a file that contains no PG-specific code whatsoever.
I'm inclined to think not --- at least, not significant enough that we
should destroy the usefulness of the magic-block check to let this work.
It could be debated though. Does anyone have any more-compelling
examples?
regards, tom lane