Commit 063cd412 by Hector Li Committed by Tianqi Chen

Add __declspec(dllexport) to class Node and class Op if build on Wind… (#296)

* Add __declspec(dllexport) to class Node and class Op if build on Windows, so that it can be referenced in some test code in MXNet

* correct typo

* reuse the macro in c_api.h

* revert changes on base.h

* one more place to revert

* use enclosing extern c block

* revert a change caused by copy

* remove a space
parent 3dd7d646
...@@ -8,21 +8,15 @@ ...@@ -8,21 +8,15 @@
#ifndef NNVM_C_API_H_ #ifndef NNVM_C_API_H_
#define NNVM_C_API_H_ #define NNVM_C_API_H_
#ifdef __cplusplus
#define NNVM_EXTERN_C extern "C"
#else
#define NNVM_EXTERN_C
#endif
/*! \brief NNVM_DLL prefix for windows */ /*! \brief NNVM_DLL prefix for windows */
#ifdef _WIN32 #ifdef _WIN32
#ifdef NNVM_EXPORTS #ifdef NNVM_EXPORTS
#define NNVM_DLL NNVM_EXTERN_C __declspec(dllexport) #define NNVM_DLL __declspec(dllexport)
#else #else
#define NNVM_DLL NNVM_EXTERN_C __declspec(dllimport) #define NNVM_DLL __declspec(dllimport)
#endif #endif
#else #else
#define NNVM_DLL NNVM_EXTERN_C #define NNVM_DLL
#endif #endif
/*! \brief manually define unsigned int */ /*! \brief manually define unsigned int */
...@@ -35,6 +29,9 @@ typedef void *SymbolHandle; ...@@ -35,6 +29,9 @@ typedef void *SymbolHandle;
/*! \brief handle to Graph */ /*! \brief handle to Graph */
typedef void *GraphHandle; typedef void *GraphHandle;
#ifdef __cplusplus
extern "C" {
#endif
/*! /*!
* \brief Set the last error message needed by C API * \brief Set the last error message needed by C API
* \param msg The error message to set. * \param msg The error message to set.
...@@ -384,4 +381,8 @@ NNVM_DLL int NNGraphApplyPasses(GraphHandle src, ...@@ -384,4 +381,8 @@ NNVM_DLL int NNGraphApplyPasses(GraphHandle src,
const char** pass_names, const char** pass_names,
GraphHandle *dst); GraphHandle *dst);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif // NNVM_C_API_H_ #endif // NNVM_C_API_H_
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <unordered_map> #include <unordered_map>
#include "./base.h" #include "./base.h"
#include "./op.h" #include "./op.h"
#include "./c_api.h"
namespace nnvm { namespace nnvm {
...@@ -94,7 +95,7 @@ struct NodeAttrs { ...@@ -94,7 +95,7 @@ struct NodeAttrs {
/*! /*!
* \brief Node represents an operation in a computation graph. * \brief Node represents an operation in a computation graph.
*/ */
class Node { class NNVM_DLL Node {
public: public:
/*! \brief The attributes in the node. */ /*! \brief The attributes in the node. */
NodeAttrs attrs; NodeAttrs attrs;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <limits> #include <limits>
#include <functional> #include <functional>
#include "./base.h" #include "./base.h"
#include "./c_api.h"
namespace nnvm { namespace nnvm {
...@@ -81,7 +82,7 @@ static const uint32_t kVarg = std::numeric_limits<uint32_t>::max(); ...@@ -81,7 +82,7 @@ static const uint32_t kVarg = std::numeric_limits<uint32_t>::max();
* } * }
* \endcode * \endcode
*/ */
class Op { class NNVM_DLL Op {
public: public:
/*! \brief name of the operator */ /*! \brief name of the operator */
std::string name; std::string name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment