Browse Source

chore: add extern "C" to some headers

greatbridf 3 years ago
parent
commit
b78d75811a
4 changed files with 32 additions and 0 deletions
  1. 8 0
      include/asm/port_io.h
  2. 8 0
      include/kernel/mem.h
  3. 8 0
      include/kernel/stdio.h
  4. 8 0
      include/kernel/vga.h

+ 8 - 0
include/asm/port_io.h

@@ -14,9 +14,17 @@
 
 #define PORT_KEYDATA 0x0060u
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern void asm_outb(uint16_t port_number, uint8_t data);
 extern uint8_t asm_inb(uint16_t port_number);
 
 extern void asm_hlt(void);
 extern void asm_cli(void);
 extern void asm_sti(void);
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
include/kernel/mem.h

@@ -2,6 +2,10 @@
 
 #include <types/stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // don't forget to add the initial 1m to the total
 struct mem_size_info {
     uint16_t n_1k_blks; // memory between 1m and 16m in 1k blocks
@@ -34,3 +38,7 @@ void init_heap(void);
 void* k_malloc(size_t size);
 
 void k_free(void* ptr);
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
include/kernel/stdio.h

@@ -2,6 +2,10 @@
 
 #include <types/stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 ssize_t
 snprint_decimal(
     char* buf,
@@ -14,3 +18,7 @@ snprintf(
     size_t buf_size,
     const char* fmt,
     ...);
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
include/kernel/vga.h

@@ -4,6 +4,10 @@
 
 #include <types/stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct vga_char {
     int8_t c;
     uint8_t color;
@@ -16,4 +20,8 @@ struct vga_char {
 void vga_put_char(struct vga_char* c);
 void vga_printk(const char* str, uint8_t color);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // _KERNEL_VGA_H_