diff --git a/include/coreinit/alarm.h b/include/coreinit/alarm.h index cd600bc..efdeaa8 100644 --- a/include/coreinit/alarm.h +++ b/include/coreinit/alarm.h @@ -4,7 +4,9 @@ #include "threadqueue.h" #include "time.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSAlarm OSAlarm; typedef struct OSAlarmLink OSAlarmLink; @@ -125,4 +127,6 @@ OSSetAlarmUserData(OSAlarm *alarm, BOOL OSWaitAlarm(OSAlarm *alarm); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/atomic64.h b/include/coreinit/atomic64.h index 2eccbc6..47c8ef4 100644 --- a/include/coreinit/atomic64.h +++ b/include/coreinit/atomic64.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif uint64_t OSGetAtomic64(uint64_t *ptr); @@ -49,4 +51,6 @@ BOOL OSTestAndSetAtomic64(uint64_t *ptr, uint32_t bit); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/baseheap.h b/include/coreinit/baseheap.h index ca9d2ea..d5256ef 100644 --- a/include/coreinit/baseheap.h +++ b/include/coreinit/baseheap.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef uint32_t MEMBaseHeapType; typedef void *MEMHeapHandle; @@ -23,4 +25,6 @@ MEMHeapHandle MEMSetBaseHeapHandle(MEMBaseHeapType type, MEMHeapHandle handle); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/cache.h b/include/coreinit/cache.h index ff660e0..032d768 100644 --- a/include/coreinit/cache.h +++ b/include/coreinit/cache.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif void DCInvalidateRange(void *addr, @@ -31,4 +33,6 @@ void DCTouchRange(void *addr, uint32_t size); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/condition.h b/include/coreinit/condition.h index 9783ce3..482e23f 100644 --- a/include/coreinit/condition.h +++ b/include/coreinit/condition.h @@ -2,7 +2,9 @@ #include #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSCondition OSCondition; typedef struct OSMutex OSMutex; @@ -41,4 +43,6 @@ OSWaitCond(OSCondition *condition, void OSSignalCond(OSCondition *condition); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/core.h b/include/coreinit/core.h index 0de551d..7dae283 100644 --- a/include/coreinit/core.h +++ b/include/coreinit/core.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif uint32_t OSGetCoreCount(); @@ -15,4 +17,6 @@ OSGetMainCoreId(); BOOL OSIsMainCore(); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/debug.h b/include/coreinit/debug.h index acb6e51..ddab4a7 100644 --- a/include/coreinit/debug.h +++ b/include/coreinit/debug.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif void OSConsoleWrite(const char *msg, @@ -18,4 +20,6 @@ OSPanic(const char *file, void OSFatal(const char *msg); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/dynload.h b/include/coreinit/dynload.h index 8dba5bf..6021a6b 100644 --- a/include/coreinit/dynload.h +++ b/include/coreinit/dynload.h @@ -3,7 +3,9 @@ #include "thread.h" #include "time.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef void *OSDynLoadModule; @@ -31,4 +33,6 @@ OSDynLoad_FindExport(OSDynLoadModule module, void OSDynLoad_Release(OSDynLoadModule module); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/event.h b/include/coreinit/event.h index c7b491d..b435c62 100644 --- a/include/coreinit/event.h +++ b/include/coreinit/event.h @@ -3,7 +3,9 @@ #include "thread.h" #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSEvent OSEvent; typedef uint32_t OSEventMode; @@ -61,4 +63,6 @@ BOOL OSWaitEventWithTimeout(OSEvent *event, OSTime timeout); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/exception.h b/include/coreinit/exception.h index 0fdc758..21900c6 100644 --- a/include/coreinit/exception.h +++ b/include/coreinit/exception.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef uint32_t OSExceptionType; typedef BOOL (*OSExceptionCallbackFn)(OSContext *context); @@ -34,4 +36,6 @@ OSSetExceptionCallbackEx(UNKNOWN_ARG, OSExceptionType exceptionType, OSExceptionCallbackFn callback); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/exit.h b/include/coreinit/exit.h index 67e3bf2..71c8cd4 100644 --- a/include/coreinit/exit.h +++ b/include/coreinit/exit.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif void exit(int code); @@ -9,4 +11,6 @@ exit(int code); void _Exit(); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/expandedheap.h b/include/coreinit/expandedheap.h index 9c6d47d..305074d 100644 --- a/include/coreinit/expandedheap.h +++ b/include/coreinit/expandedheap.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct MEMExpandedHeap MEMExpandedHeap; @@ -82,4 +84,6 @@ MEMGetGroupIDForMBlockExpHeap(uint8_t *addr); MEMExpHeapDirection MEMGetAllocDirForMBlockExpHeap(uint8_t *addr); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/fastcondition.h b/include/coreinit/fastcondition.h index b342b95..b5404ac 100644 --- a/include/coreinit/fastcondition.h +++ b/include/coreinit/fastcondition.h @@ -2,7 +2,9 @@ #include #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSFastCondition OSFastCondition; typedef struct OSFastMutex OSFastMutex; @@ -32,4 +34,6 @@ OSFastCond_Wait(OSFastCondition *condition, void OSFastCond_Signal(OSFastCondition *condition); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/fastmutex.h b/include/coreinit/fastmutex.h index b866954..0fe309a 100644 --- a/include/coreinit/fastmutex.h +++ b/include/coreinit/fastmutex.h @@ -2,7 +2,9 @@ #include #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSFastMutex OSFastMutex; typedef struct OSFastMutexLink OSFastMutexLink; @@ -46,4 +48,6 @@ OSFastMutex_Unlock(OSFastMutex *mutex); BOOL OSFastMutex_TryLock(OSFastMutex *mutex); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/frameheap.h b/include/coreinit/frameheap.h index 5b8ba9a..3232b23 100644 --- a/include/coreinit/frameheap.h +++ b/include/coreinit/frameheap.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef uint32_t MEMFrameHeapFreeMode; @@ -59,4 +61,6 @@ uint32_t MEMGetAllocatableSizeForFrmHeapEx(MEMFrameHeap *heap, int alignment); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/memlist.h b/include/coreinit/memlist.h index dc4a29c..d020303 100644 --- a/include/coreinit/memlist.h +++ b/include/coreinit/memlist.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif struct MEMMemoryLink { @@ -59,4 +61,6 @@ void * MEMGetNthListObject(MEMMEMMemoryList *list, uint16_t n); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/messagequeue.h b/include/coreinit/messagequeue.h index 127b952..dddc1cb 100644 --- a/include/coreinit/messagequeue.h +++ b/include/coreinit/messagequeue.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef uint32_t OSMessageFlags; @@ -79,4 +81,6 @@ OSPeekMessage(OSMessageQueue *queue, OSMessageQueue * OSGetSystemMessageQueue(); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/mutex.h b/include/coreinit/mutex.h index b76f3d3..5792195 100644 --- a/include/coreinit/mutex.h +++ b/include/coreinit/mutex.h @@ -2,7 +2,9 @@ #include #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSThread; @@ -66,4 +68,6 @@ OSUnlockMutex(OSMutex *mutex); BOOL OSTryLockMutex(OSMutex *mutex); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/rendezvous.h b/include/coreinit/rendezvous.h index c350309..8398aaf 100644 --- a/include/coreinit/rendezvous.h +++ b/include/coreinit/rendezvous.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSRendezvous OSRendezvous; @@ -27,4 +29,6 @@ OSWaitRendezvousWithTimeout(OSRendezvous *rendezvous, uint32_t coreMask, OSTime timeout); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/semaphore.h b/include/coreinit/semaphore.h index 90323f1..10b648a 100644 --- a/include/coreinit/semaphore.h +++ b/include/coreinit/semaphore.h @@ -2,7 +2,9 @@ #include #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSSemaphore OSSemaphore; @@ -43,4 +45,6 @@ OSWaitSemaphore(OSSemaphore *semaphore); int32_t OSTryWaitSemaphore(OSSemaphore *semaphore); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/spinlock.h b/include/coreinit/spinlock.h index cdcbdd4..051f777 100644 --- a/include/coreinit/spinlock.h +++ b/include/coreinit/spinlock.h @@ -2,7 +2,9 @@ #include #include "time.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSSpinLock OSSpinLock; @@ -48,4 +50,6 @@ OSUninterruptibleSpinLock_TryAcquireWithTimeout(OSSpinLock *spinlock, BOOL OSUninterruptibleSpinLock_Release(OSSpinLock *spinlock); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/taskqueue.h b/include/coreinit/taskqueue.h index aaa0b10..a2e2652 100644 --- a/include/coreinit/taskqueue.h +++ b/include/coreinit/taskqueue.h @@ -2,7 +2,9 @@ #include #include "time.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct MPTask MPTask; typedef struct MPTaskInfo MPTaskInfo; @@ -178,4 +180,6 @@ MPRunTasksFromTaskQ(MPTaskQueue *queue, BOOL MPRunTask(MPTask *task); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/thread.h b/include/coreinit/thread.h index 6f3632e..fe426b2 100644 --- a/include/coreinit/thread.h +++ b/include/coreinit/thread.h @@ -3,7 +3,9 @@ #include "time.h" #include "threadqueue.h" -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSContext OSContext; typedef struct OSFastMutex OSFastMutex; @@ -319,4 +321,6 @@ OSWakeupThread(OSThreadQueue *queue); void OSYieldThread(); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/threadqueue.h b/include/coreinit/threadqueue.h index 4db4c29..02e7053 100644 --- a/include/coreinit/threadqueue.h +++ b/include/coreinit/threadqueue.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSThread OSThread; @@ -46,4 +48,6 @@ void OSInitThreadQueueEx(OSThreadQueue *queue, void *parent); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/time.h b/include/coreinit/time.h index cc91ec3..f906dfa 100644 --- a/include/coreinit/time.h +++ b/include/coreinit/time.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct OSCalendarTime OSCalendarTime; @@ -44,4 +46,6 @@ void OSTicksToCalendarTime(OSTime time, OSCalendarTime *calendarTime); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/coreinit/unitheap.h b/include/coreinit/unitheap.h index e1f87cd..331ce34 100644 --- a/include/coreinit/unitheap.h +++ b/include/coreinit/unitheap.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef struct MEMUnitHeap MEMUnitHeap; @@ -38,4 +40,6 @@ MEMCalcHeapSizeForUnitHeap(uint32_t blockSize, uint32_t count, int32_t alignment); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/gx2/state.h b/include/gx2/state.h index 58db096..ccfb03c 100644 --- a/include/gx2/state.h +++ b/include/gx2/state.h @@ -1,7 +1,9 @@ #pragma once #include -WUT_LIB_HEADER_START +#ifdef __cplusplus +extern "C" { +#endif typedef uint32_t GX2InitAttributes; @@ -20,4 +22,6 @@ GX2Init(uint32_t *attributes); void GX2Shutdown(); -WUT_LIB_HEADER_END +#ifdef __cplusplus +} +#endif diff --git a/include/wut.h b/include/wut.h index a56d0fa..7414e25 100644 --- a/include/wut.h +++ b/include/wut.h @@ -1,23 +1,3 @@ #pragma once #include "wut_structsize.h" #include "wut_types.h" - -#ifdef __cplusplus - -#define WUT_LIB_HEADER_START \ - extern "C" { \ - _Pragma("pack(push, 1)") - -#define WUT_LIB_HEADER_END \ - _Pragma("pack(pop)") \ - } - -#else - -#define WUT_LIB_HEADER_START \ - _Pragma("pack(push, 1)") - -#define WUT_LIB_HEADER_END \ - _Pragma("pack(pop)") - -#endif