Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
add DLL import/export macro (ros-perception#118)
Browse files Browse the repository at this point in the history
* windows bringup

* rename dll visibility macros (#5)

* remove extra empty line (#6)
  • Loading branch information
kejxu authored Apr 3, 2020
1 parent f9e705a commit b644e70
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/SetCameraInfo.h>

#include <ros/macros.h>

// Import/export for windows dll's and visibility for gcc shared libraries.

#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
#ifdef camera_info_manager_EXPORTS // we are building a shared lib/dll
#define CAMERA_INFO_MANAGER_DECL ROS_HELPER_EXPORT
#else // we are using shared lib/dll
#define CAMERA_INFO_MANAGER_DECL ROS_HELPER_IMPORT
#endif
#else // ros is being built around static libraries
#define CAMERA_INFO_MANAGER_DECL
#endif

/** @file
@brief CameraInfo Manager interface
Expand Down Expand Up @@ -171,7 +185,7 @@ namespace camera_info_manager
*/

class CameraInfoManager
class CAMERA_INFO_MANAGER_DECL CameraInfoManager
{
public:

Expand Down
3 changes: 2 additions & 1 deletion image_transport/include/image_transport/camera_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define IMAGE_TRANSPORT_CAMERA_COMMON_H

#include <string>
#include "exports.h"

namespace image_transport {

Expand All @@ -45,7 +46,7 @@ namespace image_transport {
* \note This function assumes that the name is completely resolved. If the \c
* base_topic is remapped the resulting camera info topic will be incorrect.
*/
std::string getCameraInfoTopic(const std::string& base_topic);
IMAGE_TRANSPORT_DECL std::string getCameraInfoTopic(const std::string& base_topic);

} //namespace image_transport

Expand Down
3 changes: 2 additions & 1 deletion image_transport/include/image_transport/camera_publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include "image_transport/single_subscriber_publisher.h"
#include "exports.h"

namespace image_transport {

Expand All @@ -59,7 +60,7 @@ class ImageTransport;
* associated with that handle will stop being called. Once all CameraPublisher for a
* given base topic go out of scope the topic (and all subtopics) will be unadvertised.
*/
class CameraPublisher
class IMAGE_TRANSPORT_DECL CameraPublisher
{
public:
CameraPublisher() {}
Expand Down
3 changes: 2 additions & 1 deletion image_transport/include/image_transport/camera_subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/Image.h>
#include "image_transport/transport_hints.h"
#include "exports.h"

namespace image_transport {

Expand All @@ -59,7 +60,7 @@ void callback(const sensor_msgs::ImageConstPtr&, const sensor_msgs::CameraInfoCo
* associated with that handle will stop being called. Once all CameraSubscriber for a given
* topic go out of scope the topic will be unsubscribed.
*/
class CameraSubscriber
class IMAGE_TRANSPORT_DECL CameraSubscriber
{
public:
typedef boost::function<void(const sensor_msgs::ImageConstPtr&,
Expand Down
18 changes: 18 additions & 0 deletions image_transport/include/image_transport/exports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef IMAGE_TRANSPORT_EXPORTS_H
#define IMAGE_TRANSPORT_EXPORTS_H

#include <ros/macros.h>

// Import/export for windows dll's and visibility for gcc shared libraries.

#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
#ifdef image_transport_EXPORTS // we are building a shared lib/dll
#define IMAGE_TRANSPORT_DECL ROS_HELPER_EXPORT
#else // we are using shared lib/dll
#define IMAGE_TRANSPORT_DECL ROS_HELPER_IMPORT
#endif
#else // ros is being built around static libraries
#define IMAGE_TRANSPORT_DECL
#endif

#endif // IMAGE_TRANSPORT_EXPORTS_H
3 changes: 2 additions & 1 deletion image_transport/include/image_transport/image_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "image_transport/subscriber.h"
#include "image_transport/camera_publisher.h"
#include "image_transport/camera_subscriber.h"
#include "exports.h"

namespace image_transport {

Expand All @@ -48,7 +49,7 @@ namespace image_transport {
* ImageTransport is analogous to ros::NodeHandle in that it contains advertise() and
* subscribe() functions for creating advertisements and subscriptions of image topics.
*/
class ImageTransport
class IMAGE_TRANSPORT_DECL ImageTransport
{
public:
explicit ImageTransport(const ros::NodeHandle& nh);
Expand Down
3 changes: 2 additions & 1 deletion image_transport/include/image_transport/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "image_transport/single_subscriber_publisher.h"
#include "image_transport/exception.h"
#include "image_transport/loader_fwds.h"
#include "exports.h"

namespace image_transport {

Expand All @@ -60,7 +61,7 @@ namespace image_transport {
* associated with that handle will stop being called. Once all Publisher for a
* given base topic go out of scope the topic (and all subtopics) will be unadvertised.
*/
class Publisher
class IMAGE_TRANSPORT_DECL Publisher
{
public:
Publisher() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@
#include <boost/noncopyable.hpp>
#include <boost/function.hpp>
#include <sensor_msgs/Image.h>
#include "exports.h"

namespace image_transport {

/**
* \brief Allows publication of an image to a single subscriber. Only available inside
* subscriber connection callbacks.
*/
class SingleSubscriberPublisher : boost::noncopyable
class IMAGE_TRANSPORT_DECL SingleSubscriberPublisher : boost::noncopyable
{
public:
typedef boost::function<uint32_t()> GetNumSubscribersFn;
Expand Down
3 changes: 2 additions & 1 deletion image_transport/include/image_transport/subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "image_transport/transport_hints.h"
#include "image_transport/exception.h"
#include "image_transport/loader_fwds.h"
#include "exports.h"

namespace image_transport {

Expand All @@ -58,7 +59,7 @@ namespace image_transport {
* associated with that handle will stop being called. Once all Subscriber for a given
* topic go out of scope the topic will be unsubscribed.
*/
class Subscriber
class IMAGE_TRANSPORT_DECL Subscriber
{
public:
Subscriber() {}
Expand Down
16 changes: 15 additions & 1 deletion polled_camera/include/polled_camera/publication_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@
#include <sensor_msgs/CameraInfo.h>
#include "polled_camera/GetPolledImage.h"

#include <ros/macros.h>

// Import/export for windows dll's and visibility for gcc shared libraries.

#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
#ifdef polled_camera_EXPORTS // we are building a shared lib/dll
#define POLLED_CAMERA_DECL ROS_HELPER_EXPORT
#else // we are using shared lib/dll
#define POLLED_CAMERA_DECL ROS_HELPER_IMPORT
#endif
#else // ros is being built around static libraries
#define POLLED_CAMERA_DECL
#endif

namespace polled_camera {

/**
Expand All @@ -63,7 +77,7 @@ void callback(polled_camera::GetPolledImage::Request& req,
}
\endcode
*/
class PublicationServer
class POLLED_CAMERA_DECL PublicationServer
{
public:
typedef boost::function<void (polled_camera::GetPolledImage::Request&,
Expand Down

0 comments on commit b644e70

Please sign in to comment.