Skip to content

Commit 7b77c0f

Browse files
committed
Fix os_variant_has_internal_diagnostics link issue on Linux
1 parent 025653c commit 7b77c0f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Sources/OpenGraphCxx/DebugServer/interpose.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
// interpose.c
33
// OpenGraphCxx
44

5+
#include <OpenGraph/OGBase.h>
56
#include "stdio.h"
67
#include "stdbool.h"
78
#include "string.h"
89

9-
#define DYLD_INTERPOSE(_replacement,_replacee) \
10-
__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
11-
__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
12-
10+
#if OG_TARGET_OS_DARWIN
1311
extern bool os_variant_has_internal_diagnostics(const char *subsystem);
12+
#endif
1413

1514
bool og_variant_has_internal_diagnostics(const char *subsystem) {
1615
if (strcmp(subsystem, "org.OpenSwiftUIProject.OpenGraph") == 0) {
@@ -22,4 +21,10 @@ bool og_variant_has_internal_diagnostics(const char *subsystem) {
2221
}
2322
}
2423

24+
#if OG_TARGET_OS_DARWIN
25+
#define DYLD_INTERPOSE(_replacement,_replacee) \
26+
__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
27+
__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
28+
2529
DYLD_INTERPOSE(og_variant_has_internal_diagnostics, os_variant_has_internal_diagnostics)
30+
#endif

0 commit comments

Comments
 (0)