While digging around in the LabVIEW app data for information on the ev3p files I found that LabVIEW was built in Mono!
Mono is an open source C# environment that runs on multiple platforms, not just Windows. I have been using Mono extensively in my work for a bit over a year since we use Unity where I work. I figured that if the code for LabVIEW is written in managed C# and compiled into C# DLL’s then those DLL’s could be used by any Mono project, even one written in Unity. I was hoping I could use the code for LabVIEW and just write my own graph editor.
So I picked a few of the LabVIEW Mono DLL’s and loaded them into MonoDevelop to look at what they provided, and maybe have a peek at their code. I found quite a bit of interesting information.
For example I found the class NationalInstruments.LabVIEW.VI.VirtualMachine.Runtime.PBrick that was building buffers that seemed to be commands for communication between a computer and the EV3 Brick. Then I found the class NationalInstruments.LabVIEW.VI.VirtualMachine.Runtime.Rxe that seemed to describe VM code. I found an enum named RxeOpCode that contained the values Add (value 0), Compare (value 17) and SystemCall (value 40).
After that I found an extremely intriguing class named NationalInstruments.LabVIEW.VI.VirtualMachine.Runtime.Vivm. The reason why this was so interesting was because when I poked around the XML files describing the LabVIEW blocks they where all mentioning blocks by referencing .vix files. For example there was a block that was referencing a file called MotorSpeedSensor.vix.
And now it seems like I’ve found the class that can help me generate VI VM code! In the VI.VirtualMachine.Runtime.Vivm I found an enum called OpCode that contained values like opAddFloat32 (value 41), opCallByRef (value 2) and opSleep (value 7). This class also contained methods like WriteInstruction, WriteOpCode and WriteArg. It seems like this class could help me to bypass not only the graph builder in LabVIEW but also converting from ev3p XML files straight to byte code for the VM running on the Brick.