Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc50b36d

Browse files
committed
Update Darwin dlopen() support to avoid deprecation warnings with latest
Apple developer tools. We now use dlopen directly if available, and fallback to the older code if not. Chris Campbell
1 parent92fb5ed commitc50b36d

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

‎src/backend/port/dynloader/darwin.c

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,58 @@
11
/*
2-
* These routines were taken from the Apache source, but were made
3-
* available with a PostgreSQL-compatible license.Kudos Wilfredo
4-
* Sánchez <wsanchez@apple.com>.
2+
* Dynamic loading support for Darwin
53
*
6-
* $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.10 2004/01/07 18:56:27 neilc Exp $
4+
* If dlopen() is available (Darwin 10.3 and later), we just use it.
5+
* Otherwise we emulate it with the older, now deprecated, NSLinkModule API.
6+
*
7+
* $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.11 2006/10/08 19:31:03 tgl Exp $
78
*/
89
#include"postgres.h"
910

11+
#ifdefHAVE_DLOPEN
12+
#include<dlfcn.h>
13+
#else
1014
#include<mach-o/dyld.h>
15+
#endif
1116

1217
#include"dynloader.h"
1318

1419

15-
staticNSObjectFileImageReturnCodecofiff_result=NSObjectFileImageFailure;
20+
#ifdefHAVE_DLOPEN
21+
22+
void*
23+
pg_dlopen(char*filename)
24+
{
25+
returndlopen(filename,RTLD_NOW |RTLD_GLOBAL);
26+
}
27+
28+
void
29+
pg_dlclose(void*handle)
30+
{
31+
dlclose(handle);
32+
}
33+
34+
PGFunction
35+
pg_dlsym(void*handle,char*funcname)
36+
{
37+
/* Do not prepend an underscore: see dlopen(3) */
38+
returndlsym(handle,funcname);
39+
}
1640

41+
char*
42+
pg_dlerror(void)
43+
{
44+
returndlerror();
45+
}
46+
47+
#else/* !HAVE_DLOPEN */
48+
49+
/*
50+
* These routines were taken from the Apache source, but were made
51+
* available with a PostgreSQL-compatible license.Kudos Wilfredo
52+
* Sánchez <wsanchez@apple.com>.
53+
*/
54+
55+
staticNSObjectFileImageReturnCodecofiff_result=NSObjectFileImageFailure;
1756

1857
void*
1958
pg_dlopen(char*filename)
@@ -92,3 +131,5 @@ pg_dlerror(void)
92131

93132
return (char*)errorString;
94133
}
134+
135+
#endif/* HAVE_DLOPEN */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp