Skip to content

Commit 11f9a9f

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 6afa88f commit 11f9a9f

File tree

7 files changed

+53
-12
lines changed

7 files changed

+53
-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/libfreenect2_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/libfreenect2_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/libfreenect2_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: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This file is part of the OpenKinect Project. http://www.openkinect.org
3+
*
4+
* Copyright (c) 2014 individual OpenKinect contributors. See the CONTRIB file
5+
* for details.
6+
*
7+
* This code is licensed to you under the terms of the Apache License, version
8+
* 2.0, or, at your option, the terms of the GNU General Public License,
9+
* version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
10+
* or the following URLs:
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
* http://www.gnu.org/licenses/gpl-2.0.txt
13+
*
14+
* If you redistribute this file in source form, modified or unmodified, you
15+
* may:
16+
* 1) Leave this header intact and distribute it under the same terms,
17+
* accompanying it with the APACHE20 and GPL20 files, or
18+
* 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
19+
* 3) Delete the GPL v2 clause and accompany it with the APACHE20 file
20+
* In all cases you must keep the copyright notice intact and include a copy
21+
* of the CONTRIB file.
22+
*
23+
* Binary distributions must follow the binary distribution requirements of
24+
* either License.
25+
*/
26+
27+
#ifndef LIBFREENECT2EXPORT_H
28+
#define LIBFREENECT2EXPORT_H
29+
30+
#ifdef _WIN32
31+
# define LIBFREENECT2_API __declspec(dllexport)
32+
#else
33+
# define LIBFREENECT2_API
34+
#endif
35+
36+
#endif // LIBFREENECT2EXPORT_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 <libfreenect2/libfreenect2_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/libfreenect2_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)