I started to create a “native” configuration to compile it on a raspberry pi. While doing the groundwork in the code, I discovered a problem with the initialization sequence related to the link order. In the main, we have the devDriver global variable. It constructor initializes the iecDevice which initializes the m_device (DeviceDB). This constructor creates a MFSOwner::File variable which in turn calls the MFSOwner::testScan method. The problem is that the testScan method refers to the global variables availableFS. There is no guarantee that the constructor of availableFS is called at this point. For the program to work it has to be already executed. However, while starting my test with the native port, sometimes it works, sometimes not, depending on link order.
I started to create a “native” configuration to compile it on a raspberry pi. While doing the groundwork in the code, I discovered a problem with the initialization sequence related to the link order. In the main, we have the devDriver global variable. It constructor initializes the iecDevice which initializes the m_device (DeviceDB). This constructor creates a MFSOwner::File variable which in turn calls the MFSOwner::testScan method. The problem is that the testScan method refers to the global variables availableFS. There is no guarantee that the constructor of availableFS is called at this point. For the program to work it has to be already executed. However, while starting my test with the native port, sometimes it works, sometimes not, depending on link order.