1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Darwin porting patches from Peter Bierman <bierman@apple.com>

This commit is contained in:
Tom Lane
2000-12-11 00:49:54 +00:00
parent 839de3c577
commit 41fe2a2a03
13 changed files with 568 additions and 25 deletions

View File

@@ -3,14 +3,14 @@
* available with a PostgreSQL-compatible license. Kudos Wilfredo
* S<>nchez <wsanchez@apple.com>.
*
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.c,v 1.3 2000/11/14 21:26:21 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.c,v 1.4 2000/12/11 00:49:54 tgl Exp $
*/
#include "postgres.h"
#include <mach-o/dyld.h>
#include "dynloader.h"
void *pg_dlopen(const char *filename)
void *pg_dlopen(char *filename)
{
NSObjectFileImage image;
@@ -26,18 +26,26 @@ void pg_dlclose(void *handle)
return;
}
PGFunction pg_dlsym(void *handle, const char *funcname)
PGFunction pg_dlsym(void *handle, char *funcname)
{
NSSymbol symbol;
char *symname = (char*)malloc(strlen(funcname)+2);
sprintf(symname, "_%s", funcname);
symbol = NSLookupAndBindSymbol(symname);
free(symname);
return (PGFunction) NSAddressOfSymbol(symbol);
if (NSIsSymbolNameDefined(symname))
{
symbol = NSLookupAndBindSymbol(symname);
free(symname);
return (PGFunction) NSAddressOfSymbol(symbol);
}
else
{
free(symname);
return (PGFunction)NULL;
}
}
const char *pg_dlerror(void)
char *pg_dlerror(void)
{
return "no error message available";
}

View File

@@ -1,8 +1,8 @@
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.h,v 1.2 2000/11/09 19:00:50 petere Exp $ */
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.h,v 1.3 2000/12/11 00:49:54 tgl Exp $ */
#include "fmgr.h"
void *pg_dlopen(const char *filename);
PGFunction pg_dlsym(void *handle, const char *funcname);
void* pg_dlopen(char *filename);
PGFunction pg_dlsym(void *handle, char *funcname);
void pg_dlclose(void *handle);
const char *pg_dlerror(void);
char* pg_dlerror(void);