Skip to content

Commit

Permalink
fix(custom plugin): Resolved trtexec Fails to Build TensorRT Engine w…
Browse files Browse the repository at this point in the history
…ith Custom Plugins on Windows (#50)
  • Loading branch information
laugh12321 committed Dec 16, 2024
1 parent cc1e2f0 commit a1ce0c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions plugin/common/vfcCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ ILogger* getPluginLogger()
} // namespace plugin
} // namespace

extern "C" TENSORRTAPI void setLoggerFinder(nvinfer1::ILoggerFinder* finder)
extern "C" DEPLOYAPI void setLoggerFinder(nvinfer1::ILoggerFinder* finder)
{
nvinfer1::plugin::gLoggerFinder.setLoggerFinder(finder);
}

#if (TENSORRT_VERSION >= 100000)
extern "C" TENSORRTAPI IPluginCreatorInterface* const* getCreators(int32_t& nbCreators)
extern "C" DEPLOYAPI IPluginCreatorInterface* const* getCreators(int32_t& nbCreators)
{
nbCreators = 2;
static EfficientRotatedNMSPluginCreator efficientRotatedNMSPluginCreator;
Expand All @@ -91,7 +91,7 @@ extern "C" TENSORRTAPI IPluginCreatorInterface* const* getCreators(int32_t& nbCr
#endif

#if (TENSORRT_VERSION < 100100)
extern "C" TENSORRTAPI IPluginCreator* const* getPluginCreators(int32_t& nbCreators)
extern "C" DEPLOYAPI IPluginCreator* const* getPluginCreators(int32_t& nbCreators)
{
nbCreators = 2;
static EfficientRotatedNMSPluginCreator efficientRotatedNMSPluginCreator;
Expand Down
12 changes: 9 additions & 3 deletions plugin/common/vfcCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#include "NvInferRuntimeCommon.h"
#include "NvInferVersion.h"

#ifdef _MSC_VER
#define DEPLOYAPI __declspec(dllexport)
#else
#define DEPLOYAPI __attribute__((visibility("default")))
#endif

#define TENSORRT_VERSION (NV_TENSORRT_MAJOR * 10000L + NV_TENSORRT_MINOR * 100L + NV_TENSORRT_PATCH * 1L)

using namespace nvinfer1;
Expand All @@ -36,14 +42,14 @@ ILogger* getPluginLogger();
} // namespace plugin
} // namespace nvinfer1

extern "C" TENSORRTAPI void setLoggerFinder(nvinfer1::ILoggerFinder* finder);
extern "C" DEPLOYAPI void setLoggerFinder(nvinfer1::ILoggerFinder* finder);

#if (TENSORRT_VERSION >= 100000)
extern "C" TENSORRTAPI IPluginCreatorInterface* const* getCreators(int32_t& nbCreators);
extern "C" DEPLOYAPI IPluginCreatorInterface* const* getCreators(int32_t& nbCreators);
#endif

#if (TENSORRT_VERSION < 100100)
extern "C" TENSORRTAPI IPluginCreator* const* getPluginCreators(int32_t& nbCreators);
extern "C" DEPLOYAPI IPluginCreator* const* getPluginCreators(int32_t& nbCreators);
#endif

#endif // TRT_PLUGIN_VFC_COMMON_H

0 comments on commit a1ce0c6

Please sign in to comment.