Skip to content

Commit

Permalink
Make this compile under aarch64-linux
Browse files Browse the repository at this point in the history
  • Loading branch information
rhx committed May 4, 2024
1 parent 0026cbf commit fa64d17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/CGLib/glib_bridging.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#ifdef __linux__
#include <sys/types.h>
#include <utime.h>
extern int g_open (const char *, int, ...) __nonnull ((1));
#ifdef __aarch64__
extern int g_open(const char *, int, int) __nonnull ((1));
#define g_open g_open_orig
#else
extern int g_open(const char *, int, ...) __nonnull ((1));
#endif
#endif
#define __GLIB_H_INSIDE__
#include <glib/gversion.h>
#include <glib/gversionmacros.h>
#undef __GLIB_H_INSIDE__
#if defined(__linux__) && defined(__aarch64__)
#undef g_open
#endif

struct _GAllocator {};
struct _GAsyncQueue {};
Expand Down
15 changes: 15 additions & 0 deletions Sources/GLib/GLib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,18 @@ public func g_utime(_ path: UnsafePointer<CChar>, _ times: UnsafePointer<utimbuf
}
#endif

#if os(Linux)
/// Set the program name.
///
/// This function is a wrapper around the `g_set_prgname()` function,
/// setting the program name to the given string.
///
/// - Parameters:
/// - name: The new program name.
/// - Returns: `0` on success, `-1` on error (not implemented).
@inlinable
public func g_set_prgname_once(_ name: UnsafePointer<CChar>) -> CInt {
g_set_prgname(name)
return 0
}
#endif

0 comments on commit fa64d17

Please sign in to comment.