diff --git a/bagPositioning_test/bagPositioning_test.cpp b/bagPositioning_test/bagPositioning_test.cpp index 89ed7a7..158fb53 100644 --- a/bagPositioning_test/bagPositioning_test.cpp +++ b/bagPositioning_test/bagPositioning_test.cpp @@ -5,11 +5,14 @@ #include #include #include -#include "direct.h" #include #include "SG_bagPositioning_Export.h" #include +#ifdef _WIN32 #include +#include "direct.h" +#endif + SVzNL3DPoint _ptRotate(SVzNL3DPoint pt3D, double matrix3d[9]) { diff --git a/sourceCode/SG_bagPositioning_Export.h b/sourceCode/SG_bagPositioning_Export.h index 07891c2..f9a1847 100644 --- a/sourceCode/SG_bagPositioning_Export.h +++ b/sourceCode/SG_bagPositioning_Export.h @@ -1,9 +1,17 @@ #pragma once -#if defined(SG_API_LIBRARY) -# define SG_APISHARED_EXPORT __declspec(dllexport) +#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) #else -# define SG_APISHARED_EXPORT __declspec(dllimport) +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# define Q_DECL_IMPORT __attribute__((visibility("default"))) +#endif + +#if defined(SG_API_LIBRARY) +# define SG_BAGSHARED_EXPORT Q_DECL_EXPORT +#else +# define SG_BAGSHARED_EXPORT Q_DECL_IMPORT #endif #define OUTPUT_DEBUG 0 @@ -34,11 +42,11 @@ typedef struct double baseHoleDist; //托盘两个孔洞的距离 }SSG_stackBaseParam; -SG_APISHARED_EXPORT void sg_lineDataR(SVzNL3DLaserLine* a_line, +SG_BAGSHARED_EXPORT void sg_lineDataR(SVzNL3DLaserLine* a_line, const double* camPoseR, double groundH); -SG_APISHARED_EXPORT void sg_bagPositioning_lineProc( +SG_BAGSHARED_EXPORT void sg_bagPositioning_lineProc( SVzNL3DLaserLine* a_line, int lineIdx, int* errCode, @@ -47,7 +55,7 @@ SG_APISHARED_EXPORT void sg_bagPositioning_lineProc( const SG_bagPositionParam algoParam); //获取编织袋中心抓取点姿态,从顶部抓取 -SG_APISHARED_EXPORT void sg_getBagPosition( +SG_BAGSHARED_EXPORT void sg_getBagPosition( SVzNL3DLaserLine* laser3DPoints, int lineNum, //std::vector& all_vLineFeatures, @@ -56,13 +64,13 @@ SG_APISHARED_EXPORT void sg_getBagPosition( const SSG_planeCalibPara poseCalibPara, std::vector& objOps); -SG_APISHARED_EXPORT void sg_sideBagPosition( +SG_BAGSHARED_EXPORT void sg_sideBagPosition( SVzNL3DLaserLine* laser3DPoints, int lineNum, const SG_bagPositionParam algoParam, std::vector& objOps); -SG_APISHARED_EXPORT void sg_getSideBagStackBasePosition( +SG_BAGSHARED_EXPORT void sg_getSideBagStackBasePosition( SVzNL3DLaserLine* laser3DPoints, int lineNum, const SSG_stackBaseParam stackBaseParam, @@ -73,6 +81,6 @@ SG_APISHARED_EXPORT void sg_getSideBagStackBasePosition( //计算一个平面调平参数。 //数据输入中可以有一个地平面和参考调平平面,以最高的平面进行调平 //旋转矩阵为调平参数,即将平面法向调整为垂直向量的参数 -SG_APISHARED_EXPORT SSG_planeCalibPara sg_getBagBaseCalibPara( +SG_BAGSHARED_EXPORT SSG_planeCalibPara sg_getBagBaseCalibPara( SVzNL3DLaserLine* laser3DPoints, int lineNum); \ No newline at end of file diff --git a/sourceCode/SG_baseAlgo_Export.h b/sourceCode/SG_baseAlgo_Export.h index 552b2ec..600a5c1 100644 --- a/sourceCode/SG_baseAlgo_Export.h +++ b/sourceCode/SG_baseAlgo_Export.h @@ -1,9 +1,18 @@ #pragma once -#if defined(SG_API_LIBRARY) -# define SG_APISHARED_EXPORT __declspec(dllexport) + +#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define Q_ALGO_DECL_EXPORT __declspec(dllexport) +# define Q_ALGO_DECL_IMPORT __declspec(dllimport) #else -# define SG_APISHARED_EXPORT __declspec(dllimport) +# define Q_ALGO_DECL_EXPORT __attribute__((visibility("default"))) +# define Q_ALGO_DECL_IMPORT __attribute__((visibility("default"))) +#endif + +#if defined(SG_API_LIBRARY) +# define SG_APISHARED_EXPORT Q_ALGO_DECL_EXPORT +#else +# define SG_APISHARED_EXPORT Q_ALGO_DECL_IMPORT #endif #include "SG_baseDataType.h" diff --git a/sourceCode/SG_baseFunc.cpp b/sourceCode/SG_baseFunc.cpp index 69b5c20..d77b247 100644 --- a/sourceCode/SG_baseFunc.cpp +++ b/sourceCode/SG_baseFunc.cpp @@ -1,7 +1,12 @@ #include "SG_baseDataType.h" #include "SG_baseAlgo_Export.h" #include +#ifdef __WIN32 #include +#else +#include +#endif // __WIN32 + #include SVzNL3DRangeD sg_getScanDataROI(