Thread: Use non-deprecated APIs for dynloader/darwin.c

Use non-deprecated APIs for dynloader/darwin.c

From
Chris Campbell
Date:
Re: Darwin stuff is getting deprecated

     http://archives.postgresql.org/pgsql-hackers/2006-09/msg02238.php

Mac OS X has included dlopen() and friends etc since Mac OS X 10.3.
 From the dlopen(3) man page:

      Mac OS X 10.3 incorporated the dlcompat package written by
Jorge Acereda
      <jacereda@users.sourceforge.net> and Peter O'Gorman <ogor-
      man@users.sourceforge.net>.

      In Mac OS X 10.4, dlopen was rewritten to be a native part of
dyld.

The attached patch switches to using those APIs in src/backend/port/
dynloader/darwin.c (and passes "make check").

(1) This change requires Mac OS X 10.3 and later. Do we currently
support PostgreSQL on older versions of Mac OS X?

(2) The pg_* functions are such trivial wrappers for the OS's APIs --
should they be turned into macros in dynloader/darwin.h and we can
just delete the .c file?

(3) If we need to continue supporting Mac OS X 10.2 and earlier, I
guess we'll need to add a configure test for the presence of dlopen
()? Is that a check that should only be run on Darwin, or all platforms?

Thanks!

- Chris



Attachment

Re: Use non-deprecated APIs for dynloader/darwin.c

From
Tom Lane
Date:
Chris Campbell <chris@bignerdranch.com> writes:
> Mac OS X has included dlopen() and friends etc since Mac OS X 10.3.
> The attached patch switches to using those APIs in src/backend/port/
> dynloader/darwin.c (and passes "make check").

Looks good, but I don't think we want to abandon OSX 10.2 support
just yet.  I'll revise this to use a configure probe for dlopen.

My inclination is to apply this one now, since it only affects OSX
and should be easily testable, but to hold off on your other patch
for portable Bonjour support until 8.3 devel starts.  The portability
implications of that one are unclear, and I don't know how to test it
either, so I think putting it in now is too much risk.

            regards, tom lane