diff --git a/src/compiledata.cpp b/src/compiledata.cpp
index 03c816a2..fb53d0de 100644
--- a/src/compiledata.cpp
+++ b/src/compiledata.cpp
@@ -45,8 +45,8 @@
extern void FindPhonemesUsed(void);
extern void DisplayErrorFile(const char *fname);
-extern int utf8_in(int *c, const char *buf);
-extern int utf8_out(unsigned int c, char *buf);
+extern "C" int utf8_in(int *c, const char *buf);
+extern "C" int utf8_out(unsigned int c, char *buf);
extern void DrawEnvelopes();
extern void ReadPhondataManifest();
char path_source[sizeof(path_home)+20];
diff --git a/src/debug.h b/src/debug.h
index 199b2eb8..91177282 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,6 +1,11 @@
#ifndef DEBUG_H
#define DEBUG_H
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//#define DEBUG_ENABLED
#ifdef DEBUG_ENABLED
@@ -22,5 +27,8 @@ extern void debug_time(const char* text);
#define ENTER(text)
#endif
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/espeak_command.h b/src/espeak_command.h
index 96f42b20..9a928476 100644
--- a/src/espeak_command.h
+++ b/src/espeak_command.h
@@ -6,6 +6,11 @@
#endif
#include "speak_lib.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
enum t_espeak_type
{
ET_TEXT,
@@ -141,5 +146,9 @@ void SetParameter(int parameter, int value, int relative);
int sync_espeak_terminated_msg(unsigned int unique_identifier, void* user_data);
+#ifdef __cplusplus
+}
+#endif
+
//>
#endif
diff --git a/src/event.h b/src/event.h
index c9ee482b..840bbffb 100644
--- a/src/event.h
+++ b/src/event.h
@@ -23,6 +23,11 @@ Note: the timeout is checked against the real progress of the audio stream, whic
#include "speak_lib.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
// Initialize the event component.
// First function to be called.
// the callback will be called when the event actually occurs.
@@ -48,4 +53,8 @@ espeak_ERROR event_declare (espeak_EVENT* event);
// Last function to be called.
void event_terminate();
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/fifo.h b/src/fifo.h
index b3699ff9..f930aefa 100644
--- a/src/fifo.h
+++ b/src/fifo.h
@@ -7,6 +7,11 @@
#include "espeak_command.h"
#include "speak_lib.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
// Initialize the fifo component.
// First function to be called.
void fifo_init();
@@ -55,4 +60,8 @@ void fifo_terminate();
// Returns 1 if yes, or 0 otherwise.
int fifo_is_command_enabled();
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/klatt.h b/src/klatt.h
index e4448e4a..cf28a602 100644
--- a/src/klatt.h
+++ b/src/klatt.h
@@ -1,4 +1,7 @@
-
+#ifdef __cplusplus
+extern "C"
+{
+#endif
#define CASCADE_PARALLEL 1 /* Type of synthesis model */
#define ALL_PARALLEL 2
@@ -152,3 +155,6 @@ typedef struct {
} klatt_peaks_t;
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/options.cpp b/src/options.cpp
index 90ed670a..e0db7034 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2013 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
- * Copyright (C) 2013 by Reece H. Dunn *
+ * Copyright (C) 2013-2015 by Reece H. Dunn *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -33,7 +33,7 @@
#include "options.h"
-extern void WavegenInit(int samplerate, int wavemult_fact);
+extern "C" void WavegenInit(int samplerate, int wavemult_fact);
extern void strncpy0(char *to,const char *from, int size);
extern int GetNumeric(wxTextCtrl *t);
extern void SetNumeric(wxTextCtrl *t, int value);
diff --git a/src/phoneme.h b/src/phoneme.h
index f352032d..cd65ca9f 100644
--- a/src/phoneme.h
+++ b/src/phoneme.h
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2010 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
+ * Copyright (C) 2015 by Reece H. Dunn *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,6 +18,10 @@
* . *
***************************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
// phoneme types
@@ -169,3 +174,7 @@ extern const char *WordToString(unsigned int word);
extern PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS];
extern int phoneme_tab_number;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/sintab.h b/src/sintab.h
index 08fc18f3..9f8e275e 100644
--- a/src/sintab.h
+++ b/src/sintab.h
@@ -1,3 +1,8 @@
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
short int sin_tab[2048] = {
0, -25, -50, -75, -100, -125, -150, -175,
-201, -226, -251, -276, -301, -326, -351, -376,
@@ -256,3 +261,7 @@ short int sin_tab[2048] = {
401, 376, 351, 326, 301, 276, 251, 226,
201, 175, 150, 125, 100, 75, 50, 25,
};
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/speech.h b/src/speech.h
index 4d6a6f22..7be0d24e 100644
--- a/src/speech.h
+++ b/src/speech.h
@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
- * Copyright (C) 2013 Reece H. Dunn *
+ * Copyright (C) 2013-2015 Reece H. Dunn *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -23,6 +23,11 @@
#include
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
#define ARCH_BIG
#endif
@@ -78,4 +83,8 @@ int GetFileLength(const char *filename);
char *Alloc(int size);
void Free(void *ptr);
+#ifdef __cplusplus
+}
+#endif
+
#endif // SPEECH_H
diff --git a/src/synthesize.h b/src/synthesize.h
index b3ce5471..d8e8b24b 100644
--- a/src/synthesize.h
+++ b/src/synthesize.h
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
+ * Copyright (C) 2015 by Reece H. Dunn *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,6 +18,11 @@
* . *
***************************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
#define espeakINITIALIZE_PHONEME_IPA 0x0002 // move this to speak_lib.h, after eSpeak version 1.46.02
@@ -587,3 +593,6 @@ void KlattInit();
void KlattReset(int control);
int Wavegen_Klatt2(int length, int modulation, int resume, frame_t *fr1, frame_t *fr2);
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/translate.h b/src/translate.h
index c3634d8b..675eb03e 100644
--- a/src/translate.h
+++ b/src/translate.h
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
+ * Copyright (C) 2015 by Reece H. Dunn *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,6 +18,10 @@
* . *
***************************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
#define L(c1,c2) (c1<<8)+c2 // combine two characters into an integer for translator name
@@ -796,3 +801,7 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
extern FILE *f_trans; // for logging
extern FILE *f_logespeak;
extern int logging_type; // from config file
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/voice.h b/src/voice.h
index 36be098f..5af10c4a 100644
--- a/src/voice.h
+++ b/src/voice.h
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
+ * Copyright (C) 2015 by Reece H. Dunn *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,6 +18,11 @@
* . *
***************************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
typedef struct {
@@ -85,3 +91,6 @@ void WavegenSetVoice(voice_t *v);
void ReadTonePoints(char *string, int *tone_pts);
void VoiceReset(int control);
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/wave.h b/src/wave.h
index aac2a8dd..49e346e0 100644
--- a/src/wave.h
+++ b/src/wave.h
@@ -5,6 +5,11 @@
#include "stdint.h"
#endif
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
extern int option_device_number;
extern int wave_init(int samplerate);
@@ -40,4 +45,8 @@ extern void add_time_in_ms(struct timespec *ts, int time_in_ms);
// for tests
extern void *wave_test_get_write_buffer();
+#ifdef __cplusplus
+}
+#endif
+
#endif