Skip to content

Commit 77df7cb

Browse files
committed
Added a libfreenect2_api export macro - to apply __declspec(dllexport) infront of all classes that is used from the library libfreenect2.
If they are not specified VS won't generate a .lib file and protonect will give linking errors.
1 parent 3f58e13 commit 77df7cb

File tree

7 files changed

+27
-12
lines changed

7 files changed

+27
-12
lines changed

examples/protonect/include/libfreenect2/depth_packet_processor.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <stddef.h>
3131
#include <stdint.h>
3232

33+
#include <libfreenect2/libfreenect_export.h>
3334
#include <libfreenect2/frame_listener.hpp>
3435
#include <libfreenect2/packet_processor.h>
3536

@@ -45,10 +46,10 @@ struct DepthPacket
4546

4647
typedef PacketProcessor<DepthPacket> BaseDepthPacketProcessor;
4748

48-
class DepthPacketProcessor : public BaseDepthPacketProcessor
49+
class LIBFREENECT2_API DepthPacketProcessor : public BaseDepthPacketProcessor
4950
{
5051
public:
51-
struct Config
52+
struct LIBFREENECT2_API Config
5253
{
5354
float MinDepth;
5455
float MaxDepth;
@@ -109,7 +110,7 @@ class DepthPacketProcessor : public BaseDepthPacketProcessor
109110

110111
class OpenGLDepthPacketProcessorImpl;
111112

112-
class OpenGLDepthPacketProcessor : public DepthPacketProcessor
113+
class LIBFREENECT2_API OpenGLDepthPacketProcessor : public DepthPacketProcessor
113114
{
114115
public:
115116
OpenGLDepthPacketProcessor(void *parent_opengl_context_ptr);
@@ -139,7 +140,7 @@ class OpenGLDepthPacketProcessor : public DepthPacketProcessor
139140
// use pimpl to hide opencv dependency
140141
class CpuDepthPacketProcessorImpl;
141142

142-
class CpuDepthPacketProcessor : public DepthPacketProcessor
143+
class LIBFREENECT2_API CpuDepthPacketProcessor : public DepthPacketProcessor
143144
{
144145
public:
145146
CpuDepthPacketProcessor();

examples/protonect/include/libfreenect2/frame_listener.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
#define FRAME_LISTENER_HPP_
2929

3030
#include <cstddef>
31+
#include <libfreenect2/libfreenect_export.h>
3132

3233
namespace libfreenect2
3334
{
3435

35-
struct Frame
36+
struct LIBFREENECT2_API Frame
3637
{
3738
enum Type
3839
{
@@ -58,7 +59,7 @@ struct Frame
5859
}
5960
};
6061

61-
class FrameListener
62+
class LIBFREENECT2_API FrameListener
6263
{
6364
public:
6465
virtual ~FrameListener();

examples/protonect/include/libfreenect2/frame_listener_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ typedef std::map<Frame::Type, Frame*> FrameMap;
3737

3838
class SyncMultiFrameListenerImpl;
3939

40-
class SyncMultiFrameListener : public FrameListener
40+
class LIBFREENECT2_API SyncMultiFrameListener : public FrameListener
4141
{
4242
public:
4343
SyncMultiFrameListener(unsigned int frame_types);

examples/protonect/include/libfreenect2/libfreenect2.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
#ifndef LIBFREENECT2_HPP_
2828
#define LIBFREENECT2_HPP_
2929

30+
#include <libfreenect2/libfreenect_export.h>
3031
#include <libfreenect2/frame_listener.hpp>
3132

3233
namespace libfreenect2
3334
{
3435

3536
class PacketPipeline;
3637

37-
class Freenect2Device
38+
class LIBFREENECT2_API Freenect2Device
3839
{
3940
public:
4041
static const unsigned int VendorId = 0x045E;
@@ -70,7 +71,7 @@ class Freenect2Device
7071

7172
class Freenect2Impl;
7273

73-
class Freenect2
74+
class LIBFREENECT2_API Freenect2
7475
{
7576
public:
7677
Freenect2(void *usb_context = 0);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef LIBFREENECTEXPORT_H
2+
#define LIBFREENECTEXPORT_H
3+
4+
#ifdef _WIN32
5+
# define LIBFREENECT2_API __declspec(dllexport)
6+
#else
7+
# define LIBFREENECT2_API
8+
#endif
9+
10+
#endif // LIBFREENECTEXPORT_H

examples/protonect/include/libfreenect2/opengl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
#ifndef OPENGL_H_
2828
#define OPENGL_H_
2929

30+
#include "libfreenect_export.h"
3031
#include <GL/glew.h>
3132
#include <GLFW/glfw3.h>
3233

3334
namespace libfreenect2
3435
{
3536

36-
struct OpenGLContext
37+
struct LIBFREENECT2_API OpenGLContext
3738
{
3839
GLFWwindow *glfw_ctx;
3940
GLEWContext *glew_ctx;

examples/protonect/src/tinythread/tinythread.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ freely, subject to the following restrictions:
143143
#endif
144144
#endif
145145

146+
#include <libfreenect2\libfreenect_export.h>
146147

147148
/// Main name space for TinyThread++.
148149
/// This namespace is more or less equivalent to the @c std namespace for the
@@ -389,7 +390,7 @@ class lock_guard {
389390
/// cond.notify_all();
390391
/// }
391392
/// @endcode
392-
class condition_variable {
393+
class LIBFREENECT2_API condition_variable {
393394
public:
394395
/// Constructor.
395396
#if defined(_TTHREAD_WIN32_)
@@ -478,7 +479,7 @@ class condition_variable {
478479

479480

480481
/// Thread class.
481-
class thread {
482+
class LIBFREENECT2_API thread {
482483
public:
483484
#if defined(_TTHREAD_WIN32_)
484485
typedef HANDLE native_handle_type;

0 commit comments

Comments
 (0)