From f176d92ba06977cda1e79adaea1521a9e83b9ddf Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Tue, 22 Sep 2026 14:50:11 -0400 Subject: [PATCH 1/3] Make OfxExport export a symbol on GCC and Clang, and use it in the examples OfxExport expanded to __declspec(dllexport) on Windows and to plain extern everywhere else, so on macOS and Linux it did nothing. A plugin built with hidden visibility, as the CMake and pcons builds do, exported no entry points through it, and every example carried its own eight-line EXPORT block to add the visibility attribute. OfxExport now adds __attribute__((visibility("default"))) under GCC and Clang, which is what the header's own OfxGetPlugin and OfxGetNumberOfPlugins declarations need. The examples drop their EXPORT macros and use OfxExport directly. Each still exports exactly OfxGetPlugin and OfxGetNumberOfPlugins when built with -fvisibility=hidden. Assisted-by: Claude Code / Claude Fable 5.1 Co-Authored-By: Claude Fable 5.1 Signed-off-by: Gary Oberbrunner --- Examples/Basic/basic.cpp | 12 ++---------- Examples/ChoiceParams/choiceparams.cpp | 12 ++---------- Examples/ColourSpace/colourspace.cpp | 14 +++----------- Examples/Custom/custom.cpp | 12 ++---------- Examples/DepthConverter/depthConverter.cpp | 12 ++---------- Examples/DrawSuite/drawsuite.cpp | 12 ++---------- Examples/Invert/invert.cpp | 12 ++---------- Examples/OpenGL/opengl.cpp | 12 ++---------- Examples/Overlay/overlay.cpp | 12 ++---------- Examples/Rectangle/rectangle.cpp | 12 ++---------- Examples/Test/testProperties.cpp | 12 ++---------- include/ofxCore.h | 2 ++ release-notes-next.md | 1 + 13 files changed, 26 insertions(+), 111 deletions(-) diff --git a/Examples/Basic/basic.cpp b/Examples/Basic/basic.cpp index 71cc283a..5c931615 100644 --- a/Examples/Basic/basic.cpp +++ b/Examples/Basic/basic.cpp @@ -32,14 +32,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - template inline T Maximum(T a, T b) {return a > b ? a : b;} template inline T Minimum(T a, T b) {return a < b ? a : b;} @@ -1014,7 +1006,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -1022,7 +1014,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/ChoiceParams/choiceparams.cpp b/Examples/ChoiceParams/choiceparams.cpp index 3d5d9f06..d75d0636 100644 --- a/Examples/ChoiceParams/choiceparams.cpp +++ b/Examples/ChoiceParams/choiceparams.cpp @@ -23,14 +23,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - // pointers64 to various bits of the host OfxHost *gHost; OfxImageEffectSuiteV1 *gEffectHost = 0; @@ -760,7 +752,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -768,7 +760,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/ColourSpace/colourspace.cpp b/Examples/ColourSpace/colourspace.cpp index 7a27f623..a556b0d9 100644 --- a/Examples/ColourSpace/colourspace.cpp +++ b/Examples/ColourSpace/colourspace.cpp @@ -24,14 +24,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - enum class ColourManagementStyle { None, Basic, Core, Full, OCIO @@ -1104,7 +1096,7 @@ static OfxPlugin colourspacePlugin[] = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth < 3) @@ -1112,14 +1104,14 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 3; } // Called first after loading. This is optional for plugins. -EXPORT OfxStatus +OfxExport OfxStatus OfxSetHost() { return kOfxStatOK; diff --git a/Examples/Custom/custom.cpp b/Examples/Custom/custom.cpp index 1a37651c..6a9a7da2 100644 --- a/Examples/Custom/custom.cpp +++ b/Examples/Custom/custom.cpp @@ -30,14 +30,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - #define kPointParam "point" #define kDataParam "data" #define kBigDataParam "big_data" @@ -782,7 +774,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -790,7 +782,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/DepthConverter/depthConverter.cpp b/Examples/DepthConverter/depthConverter.cpp index a88f9dbc..a88d3c41 100644 --- a/Examples/DepthConverter/depthConverter.cpp +++ b/Examples/DepthConverter/depthConverter.cpp @@ -20,14 +20,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - // Message id for the message posted when we don't have enough bits #define kMessageNotEnoughBits "MessageIDNotEnoughBits" @@ -607,7 +599,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -615,7 +607,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/DrawSuite/drawsuite.cpp b/Examples/DrawSuite/drawsuite.cpp index cc91c312..bbe7281b 100644 --- a/Examples/DrawSuite/drawsuite.cpp +++ b/Examples/DrawSuite/drawsuite.cpp @@ -28,14 +28,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - #define kPointParam "point" // pointers to various bits of the host @@ -448,7 +440,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -456,7 +448,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Invert/invert.cpp b/Examples/Invert/invert.cpp index 6694a1cf..26dcce3d 100644 --- a/Examples/Invert/invert.cpp +++ b/Examples/Invert/invert.cpp @@ -21,14 +21,6 @@ #include "ofxMultiThread.h" #include "ofxPixels.h" -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - // pointers to various bits of the host OfxHost *gHost; OfxImageEffectSuiteV1 *gEffectHost = 0; @@ -272,7 +264,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -280,7 +272,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/OpenGL/opengl.cpp b/Examples/OpenGL/opengl.cpp index be5dee04..bf390736 100644 --- a/Examples/OpenGL/opengl.cpp +++ b/Examples/OpenGL/opengl.cpp @@ -27,14 +27,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - // pointers64 to various bits of the host OfxHost *gHost; OfxImageEffectSuiteV1 *gEffectHost = 0; @@ -672,7 +664,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -680,7 +672,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Overlay/overlay.cpp b/Examples/Overlay/overlay.cpp index 99f9764e..59fe44b6 100644 --- a/Examples/Overlay/overlay.cpp +++ b/Examples/Overlay/overlay.cpp @@ -32,14 +32,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - #define kPointParam "point" // pointers to various bits of the host @@ -429,7 +421,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -437,7 +429,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Rectangle/rectangle.cpp b/Examples/Rectangle/rectangle.cpp index a80efe89..c5a4980d 100644 --- a/Examples/Rectangle/rectangle.cpp +++ b/Examples/Rectangle/rectangle.cpp @@ -25,14 +25,6 @@ #include "../include/ofxUtilities.H" // example support utils -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - template inline T Maximum(T a, T b) {return a > b ? a : b;} template inline T Minimum(T a, T b) {return a < b ? a : b;} @@ -943,7 +935,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -951,7 +943,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Test/testProperties.cpp b/Examples/Test/testProperties.cpp index d30808c7..2a6c23bd 100644 --- a/Examples/Test/testProperties.cpp +++ b/Examples/Test/testProperties.cpp @@ -18,14 +18,6 @@ run it through a c beautifier or emacs auto formatting, automagic indenting will #include "ofxLog.H" -#if defined __APPLE__ || defined __linux__ || defined __FreeBSD__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - static OfxHost *gHost; static OfxImageEffectSuiteV1 *gEffectSuite; static OfxPropertySuiteV1 *gPropSuite; @@ -1248,7 +1240,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -EXPORT OfxPlugin * +OfxExport OfxPlugin * OfxGetPlugin(int nth) { OFX::logPrint("OfxGetPlugin - start();\n{"); @@ -1260,7 +1252,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +OfxExport int OfxGetNumberOfPlugins(void) { OFX::logPrint("OfxGetNumberOfPlugins - start();\n{"); diff --git a/include/ofxCore.h b/include/ofxCore.h index 9d2c8895..4824f740 100644 --- a/include/ofxCore.h +++ b/include/ofxCore.h @@ -24,6 +24,8 @@ Contains the core OFX architectural struct and function definitions. For more de */ #if defined(_WIN32) #define OfxExport extern __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) + #define OfxExport extern __attribute__((visibility("default"))) #else #define OfxExport extern #endif diff --git a/release-notes-next.md b/release-notes-next.md index 8fc97369..799231ee 100644 --- a/release-notes-next.md +++ b/release-notes-next.md @@ -22,6 +22,7 @@ This is version NEXT of the OpenFX API. - Set proper RGBA colour defaults on the colour parameter in the Rectangle example (issue #240). - Fixed the ColourSpace example to compile under `FMT_ENFORCE_COMPILE_STRING`, with a CI job to keep it that way (issue #236). - CMake: use `target_compile_features(cxx_std_17)` instead of forcing `CMAKE_CXX_STANDARD`, so consumers can build with a later C++ standard (issue #208). +- `OfxExport` now marks a symbol visible on GCC and Clang as well as exporting it on Windows, so plugins built with hidden visibility (as the CMake and pcons builds do) can use it for their entry points; the examples do, in place of their own `EXPORT` macros. - Fixed the `@propdef` metadata of `kOfxParamPropChoiceEnum` (a string array, not a bool) and `kOfxParamPropDimensionLabel` (one label per dimension, not one). - Fixed the Invert example never releasing its output image (a shadowed handle variable). From 4f0909a85d303274f93c152505a314d70139a1a0 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Wed, 23 Sep 2026 07:44:05 -0400 Subject: [PATCH 2/3] Drop the redundant OfxExport from the example definitions, fix OfxSetHost With the visibility attribute on the entry-point declarations in ofxCore.h, a plugin's definitions inherit it: built with hidden visibility, bare definitions of OfxGetPlugin, OfxGetNumberOfPlugins and OfxSetHost are exported and nothing else is. The examples now define them with no specifier, which is the pattern plugin authors should copy. The ColourSpace example's OfxSetHost took no parameter. In C++ that is a separate overload with C++ linkage, exported under a mangled name, so no host ever found or called it; it now takes the const OfxHost * the header declares. The release note no longer mentions a pcons build, which main does not have. Assisted-by: Claude Code / Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 (1M context) Signed-off-by: Gary Oberbrunner --- Examples/Basic/basic.cpp | 4 ++-- Examples/ChoiceParams/choiceparams.cpp | 4 ++-- Examples/ColourSpace/colourspace.cpp | 8 ++++---- Examples/Custom/custom.cpp | 4 ++-- Examples/DepthConverter/depthConverter.cpp | 4 ++-- Examples/DrawSuite/drawsuite.cpp | 4 ++-- Examples/Invert/invert.cpp | 4 ++-- Examples/OpenGL/opengl.cpp | 4 ++-- Examples/Overlay/overlay.cpp | 4 ++-- Examples/Rectangle/rectangle.cpp | 4 ++-- Examples/Test/testProperties.cpp | 4 ++-- include/ofxCore.h | 4 +++- release-notes-next.md | 3 ++- 13 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Examples/Basic/basic.cpp b/Examples/Basic/basic.cpp index 5c931615..9c0ad3d2 100644 --- a/Examples/Basic/basic.cpp +++ b/Examples/Basic/basic.cpp @@ -1006,7 +1006,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -1014,7 +1014,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/ChoiceParams/choiceparams.cpp b/Examples/ChoiceParams/choiceparams.cpp index d75d0636..7019350b 100644 --- a/Examples/ChoiceParams/choiceparams.cpp +++ b/Examples/ChoiceParams/choiceparams.cpp @@ -752,7 +752,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -760,7 +760,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/ColourSpace/colourspace.cpp b/Examples/ColourSpace/colourspace.cpp index a556b0d9..327a747d 100644 --- a/Examples/ColourSpace/colourspace.cpp +++ b/Examples/ColourSpace/colourspace.cpp @@ -1096,7 +1096,7 @@ static OfxPlugin colourspacePlugin[] = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth < 3) @@ -1104,15 +1104,15 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 3; } // Called first after loading. This is optional for plugins. -OfxExport OfxStatus -OfxSetHost() +OfxStatus +OfxSetHost(const OfxHost *) { return kOfxStatOK; } diff --git a/Examples/Custom/custom.cpp b/Examples/Custom/custom.cpp index 6a9a7da2..1effd3bb 100644 --- a/Examples/Custom/custom.cpp +++ b/Examples/Custom/custom.cpp @@ -774,7 +774,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -782,7 +782,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/DepthConverter/depthConverter.cpp b/Examples/DepthConverter/depthConverter.cpp index a88d3c41..241c3782 100644 --- a/Examples/DepthConverter/depthConverter.cpp +++ b/Examples/DepthConverter/depthConverter.cpp @@ -599,7 +599,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -607,7 +607,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/DrawSuite/drawsuite.cpp b/Examples/DrawSuite/drawsuite.cpp index bbe7281b..da3fc710 100644 --- a/Examples/DrawSuite/drawsuite.cpp +++ b/Examples/DrawSuite/drawsuite.cpp @@ -440,7 +440,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -448,7 +448,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Invert/invert.cpp b/Examples/Invert/invert.cpp index 26dcce3d..b62e385d 100644 --- a/Examples/Invert/invert.cpp +++ b/Examples/Invert/invert.cpp @@ -264,7 +264,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -272,7 +272,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/OpenGL/opengl.cpp b/Examples/OpenGL/opengl.cpp index bf390736..570b3b93 100644 --- a/Examples/OpenGL/opengl.cpp +++ b/Examples/OpenGL/opengl.cpp @@ -664,7 +664,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -672,7 +672,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Overlay/overlay.cpp b/Examples/Overlay/overlay.cpp index 59fe44b6..7113e7d6 100644 --- a/Examples/Overlay/overlay.cpp +++ b/Examples/Overlay/overlay.cpp @@ -421,7 +421,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -429,7 +429,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Rectangle/rectangle.cpp b/Examples/Rectangle/rectangle.cpp index c5a4980d..79cbf33a 100644 --- a/Examples/Rectangle/rectangle.cpp +++ b/Examples/Rectangle/rectangle.cpp @@ -935,7 +935,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -943,7 +943,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Test/testProperties.cpp b/Examples/Test/testProperties.cpp index 2a6c23bd..24ab3f0b 100644 --- a/Examples/Test/testProperties.cpp +++ b/Examples/Test/testProperties.cpp @@ -1240,7 +1240,7 @@ static OfxPlugin basicPlugin = }; // the two mandated functions -OfxExport OfxPlugin * +OfxPlugin * OfxGetPlugin(int nth) { OFX::logPrint("OfxGetPlugin - start();\n{"); @@ -1252,7 +1252,7 @@ OfxGetPlugin(int nth) return 0; } -OfxExport int +int OfxGetNumberOfPlugins(void) { OFX::logPrint("OfxGetNumberOfPlugins - start();\n{"); diff --git a/include/ofxCore.h b/include/ofxCore.h index 4824f740..7447dbb6 100644 --- a/include/ofxCore.h +++ b/include/ofxCore.h @@ -20,7 +20,9 @@ Contains the core OFX architectural struct and function definitions. For more de /** @brief Platform independent export macro. * * This macro is to be used before any symbol that is to be - * exported from a plug-in. This is OS/compiler dependent. + * exported from a plug-in. + * Ensures that the OFX entry points are exported, even when + * compiling with default-hidden symbol visibility. */ #if defined(_WIN32) #define OfxExport extern __declspec(dllexport) diff --git a/release-notes-next.md b/release-notes-next.md index f2e6bdcf..3092b1ac 100644 --- a/release-notes-next.md +++ b/release-notes-next.md @@ -23,7 +23,8 @@ This is version NEXT of the OpenFX API. - Fixed the ColourSpace example to compile under `FMT_ENFORCE_COMPILE_STRING`, with a CI job to keep it that way (issue #236). - HostSupport: an effect instance now inherits `kOfxImageEffectPropSupportsTiles` and the GPU `*RenderSupported` properties from the plugin descriptor instead of overriding them with a hard default, so values set only in describe are honoured (issue #177). The header docs now state this inheritance rule for hosts. - CMake: use `target_compile_features(cxx_std_17)` instead of forcing `CMAKE_CXX_STANDARD`, so consumers can build with a later C++ standard (issue #208). -- `OfxExport` now marks a symbol visible on GCC and Clang as well as exporting it on Windows, so plugins built with hidden visibility (as the CMake and pcons builds do) can use it for their entry points; the examples do, in place of their own `EXPORT` macros. +- `OfxExport` now marks a symbol visible on GCC and Clang as well as exporting it on Windows. The entry points in `ofxCore.h` are declared with it, so plugins built with hidden visibility export `OfxGetPlugin`, `OfxGetNumberOfPlugins` and `OfxSetHost` definitions properly. The examples no longer need to define `EXPORT` macros. +- Fixed the ColourSpace example's `OfxSetHost` to have the proper signature so it actually gets called. - Fixed the `@propdef` metadata of `kOfxParamPropChoiceEnum` (a string array, not a bool) and `kOfxParamPropDimensionLabel` (one label per dimension, not one). - Fixed the Invert example never releasing its output image (a shadowed handle variable). From edaecb46591ab26b2a524671a7d3b671d2320efc Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Wed, 23 Sep 2026 07:51:31 -0400 Subject: [PATCH 3/3] Guide: define the example entry points without an EXPORT macro The Programming Guide's five example plugins each defined the same EXPORT macro as the examples did, and marked their entry points with it. The definitions now inherit OfxExport from the declarations in ofxCore.h, which also matches the snippets the guide shows, which never had a specifier. Each still builds warning-free with hidden visibility and exports exactly OfxGetPlugin and OfxGetNumberOfPlugins. Assisted-by: Claude Code / Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 (1M context) Signed-off-by: Gary Oberbrunner --- Documentation/sources/Guide/Code/Example1/basics.cpp | 12 ++---------- Documentation/sources/Guide/Code/Example2/invert.cpp | 12 ++---------- Documentation/sources/Guide/Code/Example3/gain.cpp | 12 ++---------- .../sources/Guide/Code/Example4/saturation.cpp | 12 ++---------- Documentation/sources/Guide/Code/Example5/circle.cpp | 12 ++---------- 5 files changed, 10 insertions(+), 50 deletions(-) diff --git a/Documentation/sources/Guide/Code/Example1/basics.cpp b/Documentation/sources/Guide/Code/Example1/basics.cpp index 31df5763..21202b32 100644 --- a/Documentation/sources/Guide/Code/Example1/basics.cpp +++ b/Documentation/sources/Guide/Code/Example1/basics.cpp @@ -24,14 +24,6 @@ // the one OFX header we need, it includes the others necessary #include "ofxImageEffect.h" -#if defined __APPLE__ || defined __linux__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - //////////////////////////////////////////////////////////////////////////////// // macro to write a labelled message to stderr with #ifdef _WIN32 @@ -314,7 +306,7 @@ static OfxPlugin effectPluginStruct = // this binary. // // This will be the first function called by the host. -EXPORT int OfxGetNumberOfPlugins(void) +int OfxGetNumberOfPlugins(void) { return 1; } @@ -325,7 +317,7 @@ EXPORT int OfxGetNumberOfPlugins(void) // this binary. // // This will be called multiple times by the host, once for each plugin present. -EXPORT OfxPlugin * OfxGetPlugin(int nth) +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) return &effectPluginStruct; diff --git a/Documentation/sources/Guide/Code/Example2/invert.cpp b/Documentation/sources/Guide/Code/Example2/invert.cpp index 2ce365b0..f8f2fa12 100644 --- a/Documentation/sources/Guide/Code/Example2/invert.cpp +++ b/Documentation/sources/Guide/Code/Example2/invert.cpp @@ -19,14 +19,6 @@ // the one OFX header we need, it includes the others necessary #include "ofxImageEffect.h" -#if defined __APPLE__ || defined __linux__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - //////////////////////////////////////////////////////////////////////////////// // macro to write a labelled message to stderr with #ifdef _WIN32 @@ -440,7 +432,7 @@ static OfxPlugin effectPluginStruct = // this binary. // // This will be the first function called by the host. -EXPORT int OfxGetNumberOfPlugins(void) +int OfxGetNumberOfPlugins(void) { return 1; } @@ -451,7 +443,7 @@ EXPORT int OfxGetNumberOfPlugins(void) // this binary. // // This will be called multiple times by the host, once for each plugin present. -EXPORT OfxPlugin * OfxGetPlugin(int nth) +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) return &effectPluginStruct; diff --git a/Documentation/sources/Guide/Code/Example3/gain.cpp b/Documentation/sources/Guide/Code/Example3/gain.cpp index fbbff63f..73ce3b91 100644 --- a/Documentation/sources/Guide/Code/Example3/gain.cpp +++ b/Documentation/sources/Guide/Code/Example3/gain.cpp @@ -21,14 +21,6 @@ // the one OFX header we need, it includes the others necessary #include "ofxImageEffect.h" -#if defined __APPLE__ || defined __linux__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - //////////////////////////////////////////////////////////////////////////////// // macro to write a labelled message to stderr with #ifdef _WIN32 @@ -662,7 +654,7 @@ static OfxPlugin effectPluginStruct = // this binary. // // This will be the first function called by the host. -EXPORT int OfxGetNumberOfPlugins(void) +int OfxGetNumberOfPlugins(void) { return 1; } @@ -673,7 +665,7 @@ EXPORT int OfxGetNumberOfPlugins(void) // this binary. // // This will be called multiple times by the host, once for each plugin present. -EXPORT OfxPlugin * OfxGetPlugin(int nth) +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) return &effectPluginStruct; diff --git a/Documentation/sources/Guide/Code/Example4/saturation.cpp b/Documentation/sources/Guide/Code/Example4/saturation.cpp index 4d9f2e7d..4a9e2a6d 100644 --- a/Documentation/sources/Guide/Code/Example4/saturation.cpp +++ b/Documentation/sources/Guide/Code/Example4/saturation.cpp @@ -21,14 +21,6 @@ // the one OFX header we need, it includes the others necessary #include "ofxImageEffect.h" -#if defined __APPLE__ || defined __linux__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - //////////////////////////////////////////////////////////////////////////////// // macro to write a labelled message to stderr with #ifdef _WIN32 @@ -793,7 +785,7 @@ static OfxPlugin effectPluginStruct = // this binary. // // This will be the first function called by the host. -EXPORT int OfxGetNumberOfPlugins(void) +int OfxGetNumberOfPlugins(void) { return 1; } @@ -804,7 +796,7 @@ EXPORT int OfxGetNumberOfPlugins(void) // this binary. // // This will be called multiple times by the host, once for each plugin present. -EXPORT OfxPlugin * OfxGetPlugin(int nth) +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) return &effectPluginStruct; diff --git a/Documentation/sources/Guide/Code/Example5/circle.cpp b/Documentation/sources/Guide/Code/Example5/circle.cpp index 754ab12c..3357f2ea 100644 --- a/Documentation/sources/Guide/Code/Example5/circle.cpp +++ b/Documentation/sources/Guide/Code/Example5/circle.cpp @@ -21,14 +21,6 @@ // the one OFX header we need, it includes the others necessary #include "ofxImageEffect.h" -#if defined __APPLE__ || defined __linux__ -# define EXPORT __attribute__((visibility("default"))) -#elif defined _WIN32 -# define EXPORT OfxExport -#else -# error Not building on your operating system quite yet -#endif - //////////////////////////////////////////////////////////////////////////////// // macro to write a labelled message to stderr with #ifdef _WIN32 @@ -992,7 +984,7 @@ static OfxPlugin effectPluginStruct = // this binary. // // This will be the first function called by the host. -EXPORT int OfxGetNumberOfPlugins(void) +int OfxGetNumberOfPlugins(void) { return 1; } @@ -1003,7 +995,7 @@ EXPORT int OfxGetNumberOfPlugins(void) // this binary. // // This will be called multiple times by the host, once for each plugin present. -EXPORT OfxPlugin * OfxGetPlugin(int nth) +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) return &effectPluginStruct;