Skip to content

Commit 0bdf05a

Browse files
committed
Make this compile under aarch64-linux
1 parent 89a1c48 commit 0bdf05a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Sources/CGLib/glib_bridging.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#ifdef __linux__
22
#include <sys/types.h>
33
#include <utime.h>
4-
extern int g_open (const char *, int, ...) __nonnull ((1));
4+
#ifdef __aarch64__
5+
extern int g_open(const char *, int, int) __nonnull ((1));
6+
#define g_open g_open_orig
7+
#else
8+
extern int g_open(const char *, int, ...) __nonnull ((1));
9+
#endif
510
#endif
611
#define __GLIB_H_INSIDE__
712
#include <glib/gversion.h>
813
#include <glib/gversionmacros.h>
914
#undef __GLIB_H_INSIDE__
15+
#if defined(__linux__) && defined(__aarch64__)
16+
#undef g_open
17+
#endif
1018

1119
struct _GAllocator {};
1220
struct _GAsyncQueue {};

Sources/GLib/GLib.swift

+15
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,18 @@ public func g_utime(_ path: UnsafePointer<CChar>, _ times: UnsafePointer<utimbuf
390390
}
391391
#endif
392392

393+
#if os(Linux)
394+
/// Set the program name.
395+
///
396+
/// This function is a wrapper around the `g_set_prgname()` function,
397+
/// setting the program name to the given string.
398+
///
399+
/// - Parameters:
400+
/// - name: The new program name.
401+
/// - Returns: `0` on success, `-1` on error (not implemented).
402+
@inlinable
403+
public func g_set_prgname_once(_ name: UnsafePointer<CChar>) -> CInt {
404+
g_set_prgname(name)
405+
return 0
406+
}
407+
#endif

0 commit comments

Comments
 (0)