Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1635 from klickverbot/osx-dlfcn
Browse files Browse the repository at this point in the history
Add non-POSIX dlfcn extensions for Darwin, add const to dladdr
  • Loading branch information
MartinNowak committed Aug 18, 2016
2 parents b26811d + 4e8eb14 commit 7758492
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
40 changes: 40 additions & 0 deletions src/core/sys/darwin/dlfcn.d
@@ -0,0 +1,40 @@
/**
* D header file for Darwin.
*
* $(LINK2 https://opensource.apple.com/source/dyld/dyld-360.22/include/dlfcn.h, Apple dyld/dlfcn.h)
*
* Copyright: Copyright David Nadlinger 2016.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: David Nadlinger
*/
module core.sys.darwin.dlfcn;

version (OSX)
version = Darwin;
else version (iOS)
version = Darwin;
else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;

version (Darwin):
extern(C):
nothrow:
@nogc:

public import core.sys.posix.dlfcn;

struct Dl_info
{
const(char)* dli_fname;
void* dli_fbase;
const(char)* dli_sname;
void* dli_saddr;
}

int dladdr(in void* addr, Dl_info* info);

enum RTLD_NOLOAD = 0x10;
enum RTLD_NODELETE = 0x80;
enum RTLD_FIRST = 0x100;
2 changes: 1 addition & 1 deletion src/core/sys/linux/dlfcn.d
Expand Up @@ -265,7 +265,7 @@ static if (__USE_GNU)
void* dli_saddr;
}

int dladdr(void* __address, Dl_info* __info);
int dladdr(in void* __address, Dl_info* __info);
int dladdr1(void* __address, Dl_info* __info, void** __extra_info, int __flags);

enum
Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/posix/dlfcn.d
Expand Up @@ -120,7 +120,7 @@ version( CRuntime_Glibc )

deprecated("Please use core.sys.linux.dlfcn for non-POSIX extensions")
{
int dladdr(void* addr, Dl_info* info);
int dladdr(in void* addr, Dl_info* info);
void* dlvsym(void* handle, in char* symbol, in char* version_);

struct Dl_info
Expand Down

0 comments on commit 7758492

Please sign in to comment.