idolpx / meatloaf

A Commodore IEC Serial multi-device emulator
https://meatloaf.cc
GNU General Public License v3.0
126 stars 23 forks source link

initialization order link error #13

Closed yheneault closed 10 months ago

yheneault commented 1 year ago

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.

idolpx commented 10 months ago

Sorry so slow. I'm curious to know if you resolved this. I'm just getting back to updating this repo with code from the ESP32 port.