ringbuffer: use a namespace for ringbuffer to avoid 'multiple definitions in vtable' bug

This commit is contained in:
Ban Siesta
2015-05-24 10:02:08 +01:00
parent b9ce447cc9
commit aac276872b
3 changed files with 14 additions and 10 deletions
+5 -7
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2013 PX4 Development Team. All rights reserved.
* Copyright (C) 2013-2015 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +43,9 @@
#include <stdint.h>
#include <stdio.h>
namespace ringbuffer __EXPORT
{
class RingBuffer {
public:
RingBuffer(unsigned ring_size, size_t entry_size);
@@ -172,9 +175,4 @@ private:
RingBuffer operator=(const RingBuffer&);
};
#ifdef __PX4_NUTTX
// Not sure why NuttX requires these to be defined in the header file
// but on other targets it causes a problem with multiple definitions
// at link time
#include "ringbuffer.cpp"
#endif
} // namespace ringbuffer