Closed TheOneRing closed 6 years ago
Thanks! Just to make sure I'm up to speed, is this what I need to do for each analyzer?
cmake/ExternalAnalyzerSDK.cmake
and CMakeLists.txt
file with these changes.ANALYZER_EXPORT
from everything except for the extern "C"
functions.ANALYZER_EXPORT
with ANALYZER_PLUGIN_EXPORT
on the extern "C"
functions.In addition, I'll need to update the AnalyzerSDK github repository with the latest changes to Analyzer.h, which now includes the ANALYZER_PLUGIN_EXPORT
definition.
One last thing - the latest changes to Analyzer.h contain an include for the export header generated by cmake, and I assume compilation will fail when that file is not found when an analyzer is built outside of the Logic software. Should I just include a copy of that generated file in the AnalyzerSDK repository?
I can get this updated pretty quickly, but I'd like to wait for your OK before I do so. Since the update is done in-bulk, once master is updated I'll close this PR.
As the export header differs on all platforms we probably should generate it in the sdk too.
Instead of exporting the C functions I thought about a macro (how its done in Qt). Two macros like those (untested), one for the header.
#define DECLARE_ANALYZER extern "C" {\
ANALYZER_PLUGIN_EXPORT const char* __cdecl GetAnalyzerName();\
ANALYZER_PLUGIN_EXPORT Analyzer* __cdecl CreateAnalyzer( );\
ANALYZER_PLUGIN_EXPORT void __cdecl DestroyAnalyzer( Analyzer* analyzer );}
and for the .cpp
#define DEFINE_ANALYZER (CLASS, NAME, DESTRUCTOR)\
const char* GetAnalyzerName()\
{\
return NAME;\
}\
Analyzer* CreateAnalyzer()\
{\
return new CLASS;\
}\
void DestroyAnalyzer( Analyzer* analyzer )\
{\
DESTRUCTOR;\
}\
All changes have been made except I haven't added the macro - something I'd like to do in the future, probably when we update https://github.com/saleae/SampleAnalyzer, and start getting customers to start developing analyzers with the new layout. I'll go ahead and close this. Could you open a PR on https://github.com/saleae/AnalyzerSDK with the export header generation?
@Marcus10110