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 @@
#ifndef 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 */
#ifdef _WIN32
#ifdef NNVM_EXPORTS
#define NNVM_DLL NNVM_EXTERN_C __declspec(dllexport)
#define NNVM_DLL __declspec(dllexport)
#else
#define NNVM_DLL NNVM_EXTERN_C __declspec(dllimport)
#define NNVM_DLL __declspec(dllimport)
#endif
#else
#define NNVM_DLL NNVM_EXTERN_C
#define NNVM_DLL
#endif
/*! \brief manually define unsigned int */
......@@ -35,6 +29,9 @@ typedef void *SymbolHandle;
/*! \brief handle to Graph */
typedef void *GraphHandle;
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \brief Set the last error message needed by C API
* \param msg The error message to set.
......@@ -384,4 +381,8 @@ NNVM_DLL int NNGraphApplyPasses(GraphHandle src,
const char** pass_names,
GraphHandle *dst);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif // NNVM_C_API_H_
......@@ -12,6 +12,7 @@
#include <unordered_map>
#include "./base.h"
#include "./op.h"
#include "./c_api.h"
namespace nnvm {
......@@ -94,7 +95,7 @@ struct NodeAttrs {
/*!
* \brief Node represents an operation in a computation graph.
*/
class Node {
class NNVM_DLL Node {
public:
/*! \brief The attributes in the node. */
NodeAttrs attrs;
......
......@@ -14,6 +14,7 @@
#include <limits>
#include <functional>
#include "./base.h"
#include "./c_api.h"
namespace nnvm {
......@@ -81,7 +82,7 @@ static const uint32_t kVarg = std::numeric_limits<uint32_t>::max();
* }
* \endcode
*/
class Op {
class NNVM_DLL Op {
public:
/*! \brief name of the operator */
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