Main runtime template C code : Added HAVE_RETAIN preprocessor definition for customized build to signal it provides IEC-61131 Retain memory handling function. Removed targets/Xenomai/plc_Xenomai_noretain.c, now useless.
--- a/targets/Linux/plc_Linux_main.c Mon Jan 15 14:43:53 2018 +0100
+++ b/targets/Linux/plc_Linux_main.c Fri Jan 19 15:12:23 2018 +0100
@@ -232,6 +232,7 @@
pthread_mutex_lock(&python_mutex);
}
+#ifndef HAVE_RETAIN
void InitRetain(void)
{
}
@@ -260,3 +261,4 @@
void Remind(unsigned int offset, unsigned int count, void *p)
{
}
+#endif // !HAVE_RETAIN
--- a/targets/Win32/plc_Win32_main.c Mon Jan 15 14:43:53 2018 +0100
+++ b/targets/Win32/plc_Win32_main.c Fri Jan 19 15:12:23 2018 +0100
@@ -241,6 +241,7 @@
WaitForSingleObject(python_sem, INFINITE);
}
+#ifndef HAVE_RETAIN
void InitRetain(void)
{
}
@@ -275,6 +276,7 @@
void Remind(unsigned int offset, unsigned int count, void *p)
{
}
+#endif // !HAVE_RETAIN
static void __attribute__((constructor))
beremiz_dll_init(void)
--- a/targets/Xenomai/plc_Xenomai_main.c Mon Jan 15 14:43:53 2018 +0100
+++ b/targets/Xenomai/plc_Xenomai_main.c Fri Jan 19 15:12:23 2018 +0100
@@ -363,6 +363,7 @@
} /* as plc does not wait for lock. */
}
+#ifndef HAVE_RETAIN
int CheckRetainBuffer(void)
{
return 1;
@@ -391,3 +392,4 @@
void InitRetain(void)
{
}
+#endif // !HAVE_RETAIN
--- a/targets/Xenomai/plc_Xenomai_noretain.c Mon Jan 15 14:43:53 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-int CheckRetainBuffer(void)
-{
- return 1;
-}
-
-void ValidateRetainBuffer(void)
-{
-}
-
-void InValidateRetainBuffer(void)
-{
-}
-
-void Retain(unsigned int offset, unsigned int count, void *p)
-{
-}
-
-void Remind(unsigned int offset, unsigned int count, void *p)
-{
-}
-
-void CleanupRetain(void)
-{
-}
-
-void InitRetain(void)
-{
-}