Skip to content

Commit f0f1d12

Browse files
committed
Arduino support: C++ and linker issues
1 parent 90d0bba commit f0f1d12

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

openaptx.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828

2929
#include <stddef.h>
3030

31+
#ifdef __cplusplus
32+
extern "C"
33+
{
34+
#endif
35+
36+
3137
extern const int aptx_major;
3238
extern const int aptx_minor;
3339
extern const int aptx_patch;
@@ -142,4 +148,9 @@ size_t aptx_decode_sync(struct aptx_context *ctx,
142148
*/
143149
size_t aptx_decode_sync_finish(struct aptx_context *ctx);
144150

151+
152+
#ifdef __cplusplus
153+
}
154+
#endif
155+
145156
#endif

openaptxdec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
#ifndef ARDUINO
23+
2224
#include <stdio.h>
2325
#include <string.h>
2426

@@ -191,3 +193,5 @@ int main(int argc, char *argv[])
191193
aptx_finish(ctx);
192194
return ret;
193195
}
196+
197+
#endif

openaptxenc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
#ifndef ARDUINO
23+
2224
#include <stdio.h>
2325
#include <string.h>
2426

@@ -119,3 +121,5 @@ int main(int argc, char *argv[])
119121
aptx_finish(ctx);
120122
return ret;
121123
}
124+
125+
#endif

0 commit comments

Comments
 (0)