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; diff --git a/Examples/Basic/basic.cpp b/Examples/Basic/basic.cpp index 71cc283a..9c0ad3d2 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -1022,7 +1014,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/ChoiceParams/choiceparams.cpp b/Examples/ChoiceParams/choiceparams.cpp index 3d5d9f06..7019350b 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -768,7 +760,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/ColourSpace/colourspace.cpp b/Examples/ColourSpace/colourspace.cpp index 7a27f623..327a747d 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth < 3) @@ -1112,15 +1104,15 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 3; } // Called first after loading. This is optional for plugins. -EXPORT OfxStatus -OfxSetHost() +OfxStatus +OfxSetHost(const OfxHost *) { return kOfxStatOK; } diff --git a/Examples/Custom/custom.cpp b/Examples/Custom/custom.cpp index 1a37651c..1effd3bb 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -790,7 +782,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/DepthConverter/depthConverter.cpp b/Examples/DepthConverter/depthConverter.cpp index a88f9dbc..241c3782 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -615,7 +607,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/DrawSuite/drawsuite.cpp b/Examples/DrawSuite/drawsuite.cpp index cc91c312..da3fc710 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -456,7 +448,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Invert/invert.cpp b/Examples/Invert/invert.cpp index 6694a1cf..b62e385d 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -280,7 +272,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/OpenGL/opengl.cpp b/Examples/OpenGL/opengl.cpp index be5dee04..570b3b93 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -680,7 +672,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Overlay/overlay.cpp b/Examples/Overlay/overlay.cpp index 99f9764e..7113e7d6 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -437,7 +429,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Rectangle/rectangle.cpp b/Examples/Rectangle/rectangle.cpp index a80efe89..79cbf33a 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 * +OfxPlugin * OfxGetPlugin(int nth) { if(nth == 0) @@ -951,7 +943,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { return 1; diff --git a/Examples/Test/testProperties.cpp b/Examples/Test/testProperties.cpp index d30808c7..24ab3f0b 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 * +OfxPlugin * OfxGetPlugin(int nth) { OFX::logPrint("OfxGetPlugin - start();\n{"); @@ -1260,7 +1252,7 @@ OfxGetPlugin(int nth) return 0; } -EXPORT int +int OfxGetNumberOfPlugins(void) { OFX::logPrint("OfxGetNumberOfPlugins - start();\n{"); diff --git a/include/ofxCore.h b/include/ofxCore.h index 9d2c8895..7447dbb6 100644 --- a/include/ofxCore.h +++ b/include/ofxCore.h @@ -20,10 +20,14 @@ 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) +#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 8e540276..3092b1ac 100644 --- a/release-notes-next.md +++ b/release-notes-next.md @@ -23,6 +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. 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).