is a different product than CPython
which just tries to implement the same language. IronPython is a complete re-implementation of the Python core in C# with a completely different internal architecture, using the Dynamic Language Runtime
of the .NET Framework, while the original CPython is a Bytecode Interpreter
implemented in C.
follows a similar goal with a pure Java implementation of Python. See Why Are There So Many Pythons?
for an explanation of (some of) the different implementations of Python.
All the parts of the standard library which CPython implements in C were reimplemented in C# for the IronPython project (or are still missing / not supported). The cTypes module is one of them. Thus, it is naturally that it contains a different set of quirks and bugs compared to the CPython cTypes module.
Additionally, IronPython is not as widespread as CPython, and thus not that well tested in those corner areas like cTypes.
CODESYS and the CODESYS Test Manager include IronPython, because the CODESYS V3 IDE is implemented in .NET, and IronPython naturally fits there. It is not easily possible
to just replace IronPython by CPython in CODESYS, because the internal structures of the interpreter are completely different. CPython code cannot call into .NET objects, thus it would be impossible to call into any CODESYS function, rendering it completely useless for that purpose.
We did investigate alternatives, like the Python for .NET
project which aims to provide a bridge between CPython and .NET, but this project seems to be unmaintained since 2007, and thus is not suitable base for a script engine for CODESYS.
As for the workaround solutions, I think I did already mention most of them via E-Mail, including:
- Generate interop assemblies for the DLL, and load those via the Python script.
- Use Labview directly (or CPython and the generated DLL) to generate a reference table containing the input and output values (e. G. CSV or XML), and then use the IronPython script in CODESYS to read that reference table.
- Use the reference table from above to generate IEC code which represents the test cases, and import said Code into the Test Manager for the IEC Unit Test functionality.
- Use C++/CLI or C# and P/Invoke to generate a .NET wrapper code which can be used from IronPython via clr.AddReference().
- Use P/Invoke from IronPython instead of cTypes.
Check out the CODESYS store: http://store.codesys.com/CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions