Skip to content

Commit 053127b

Browse files
authored
Merge pull request #500 from Ziemas/iop-cpp
Add extern "C" to IOP headers for C++ support.
2 parents a82ef0b + 76c1f17 commit 053127b

36 files changed

+290
-2
lines changed

iop/kernel/include/cdvdfsv.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@
1919
#include <types.h>
2020
#include <irx.h>
2121

22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
2226
int sceCdChangeThreadPriority(int priority);
2327

2428
#define cdvdfsv_IMPORTS_start DECLARE_IMPORT_TABLE(cdvdfsv, 1, 1)
2529
#define cdvdfsv_IMPORTS_end END_IMPORT_TABLE
2630

2731
#define I_sceCdChangeThreadPriority DECLARE_IMPORT(5, sceCdChangeThreadPriority)
2832

33+
#ifdef __cplusplus
34+
}
35+
#endif
36+
2937
#endif /* __CDVDFSV_H__ */

iop/kernel/include/cdvdman.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
#include <libcdvd-common.h>
2323

24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
2428
//IOP-only libcdvd function prototypes.
2529
int sceCdCheckCmd(void);
2630
int sceCdNop(void);
@@ -175,4 +179,8 @@ int sceCdReadDiskID(unsigned int *id);
175179
#define I_sceCdReadRegionParams DECLARE_IMPORT(189, sceCdReadRegionParams)
176180
#define I_sceCdWriteRegionParams DECLARE_IMPORT(191, sceCdWriteRegionParams)
177181

182+
#ifdef __cplusplus
183+
}
184+
#endif
185+
178186
#endif /* __CDVDMAN_H__ */

iop/kernel/include/ctype.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#ifndef __CTYPE_H__
1717
#define __CTYPE_H__
1818

19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
1923
#define isascii(c) ((unsigned int)(c) <= 127)
2024
#define toascii(c) ((unsigned char)(c) & 127)
2125

@@ -87,4 +91,8 @@
8791

8892
#endif
8993

94+
#ifdef __cplusplus
95+
}
96+
#endif
97+
9098
#endif /* __CTYPE_H__ */

iop/kernel/include/defs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818

1919
#include <types.h>
2020

21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
2125
#ifndef NULL
2226
#define NULL ((void *)0)
2327
#endif
@@ -84,4 +88,8 @@ static inline void *iop_memcpy(void *dest, const void *src, int size)
8488
return dest;
8589
}
8690

91+
#ifdef __cplusplus
92+
}
93+
#endif
94+
8795
#endif /* __DEFS_H__ */

iop/kernel/include/dmacman.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include <types.h>
2020
#include <irx.h>
2121

22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
2226
typedef struct _iop_dmac_chan {
2327
u32 madr;
2428
u32 bcr;
@@ -166,4 +170,8 @@ void dmac_disable(u32 channel); //sceDisableDMAChannel
166170
#define I_dmac_enable DECLARE_IMPORT(34, dmac_enable)
167171
#define I_dmac_disable DECLARE_IMPORT(35, dmac_disable)
168172

173+
#ifdef __cplusplus
174+
}
175+
#endif
176+
169177
#endif /* __DMACMAN_H__ */

iop/kernel/include/excepman.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include <types.h>
2020
#include <irx.h>
2121

22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
2226
/* From any r3000's cop0 documentation */
2327
/** External Interrupt */
2428
#define IOP_EXCEPTION_INT 0
@@ -81,4 +85,8 @@ int ReleaseDefaultExceptionHandler(exception_handler_t);
8185
#define I_ReleaseExceptionHandler DECLARE_IMPORT(7, ReleaseExceptionHandler)
8286
#define I_ReleaseDefaultExceptionHandler DECLARE_IMPORT(8, ReleaseDefaultExceptionHandler)
8387

88+
#ifdef __cplusplus
89+
}
90+
#endif
91+
8492
#endif /* __EXCEPMAN_H__ */

iop/kernel/include/heaplib.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include <types.h>
2020
#include <irx.h>
2121

22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
2226
void *CreateHeap(int heapblocksize, int flag);
2327
void DeleteHeap(void *heap);
2428
void *AllocHeapMemory(void *heap, size_t nbytes);
@@ -39,4 +43,8 @@ int HeapChunkSize(void* chunk);
3943
#define I_HeapPrepare DECLARE_IMPORT(11, HeapPrepare)
4044
#define I_HeapChunkSize DECLARE_IMPORT(15, HeapChunkSize)
4145

46+
#ifdef __cplusplus
47+
}
48+
#endif
49+
4250
#endif /* __HEAPLIB_H__ */

iop/kernel/include/intrman.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include <types.h>
2020
#include <irx.h>
2121

22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
2226
enum iop_irq_list {
2327
IOP_IRQ_VBLANK = 0,
2428
/** INUM_GM */
@@ -222,4 +226,8 @@ int SetShouldPreemptCb(void *cb);
222226
#define I_SetNewCtxCb DECLARE_IMPORT(28, SetNewCtxCb)
223227
#define I_SetShouldPreemptCb DECLARE_IMPORT(30, SetShouldPreemptCb)
224228

229+
#ifdef __cplusplus
230+
}
231+
#endif
232+
225233
#endif /* __INTRMAN_H__ */

iop/kernel/include/ioman.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#include <irx.h>
2121
#include <io_common.h>
2222

23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
2327
int open(const char *name, int mode);
2428
int close(int fd);
2529
int read(int fd, void *ptr, size_t size);
@@ -110,4 +114,8 @@ int DelDrv(const char *name);
110114
#define I_AddDrv DECLARE_IMPORT(20, AddDrv);
111115
#define I_DelDrv DECLARE_IMPORT(21, DelDrv);
112116

117+
#ifdef __cplusplus
118+
}
119+
#endif
120+
113121
#endif /* __IOMAN_H__ */

iop/kernel/include/iomanX.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
#include <io_common.h>
2525
#include <iox_stat.h>
2626

27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
2731
// Rename prototype names in order to avoid clashes with other standard I/O libraries.
2832
#ifndef IOMANX_OLD_NAME_COMPATIBILITY
2933
#ifdef _IOP
@@ -379,4 +383,8 @@ static inline void StdioInit(int mode)
379383

380384
#endif /* IOMANX_OLD_NAME_COMPATIBILITY */
381385

386+
#ifdef __cplusplus
387+
}
388+
#endif
389+
382390
#endif /* __IOMANX_H__ */

0 commit comments

Comments
 (0)