diff Plugins/Samples/Basic/Plugin.c @ 1039:5a5a4890ffca

check version in plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jul 2014 12:46:00 +0200
parents 3e43de893d88
children d06186cdc502
line wrap: on
line diff
--- a/Plugins/Samples/Basic/Plugin.c	Wed Jul 16 16:51:26 2014 +0200
+++ b/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 12:46:00 2014 +0200
@@ -134,6 +134,18 @@
   char info[1024];
   char *id, *eos;
 
+  char error[256];
+  if (OrthancPluginCheckVersion(c) == 0)
+  {
+    sprintf(error, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
+            c->orthancVersion,
+            ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
+            ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
+            ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
+    OrthancPluginLogError(context, error);
+    return -1;
+  }
+
   context = c;
   OrthancPluginLogWarning(context, "Sample plugin is initializing");