Closed Olliebrown closed 2 years ago
I think this is a dynamic initialization order problem. It seems that line 738 of labels.cc is running BEFORE line 171. The variable declared at line 171 (the AEMode LabelMap) is used at 738 inside of the "Option" unordered_map. Since the LabelMap variables used by "Option" are not yet initialized (they are still null references), they are all failing to copy as the "Option" unordered_map is constructed.
At least, this is the observed behavior when I set breakpoints on those two lines: 738 breaks before 171. The real question is why the heck the compiler is ordering them that way (and how can we get it to stop it). I might investigate if this is a known issue with my particular version of the MSVC compiler.
@Olliebrown Thank you very much
Merged, Thank you!
It seems to be a known issue. I refactored all the static lists/maps into functions. This should take care of the dynamic initialization order. :-)
This is related to #2 and results in the same error, but that is a very generic error and I have found that my problem seems to require a different solution from what was posed in that issue.
The error comes up when you do
npm run package
and is the result of theupdate-stubs.js
script:I followed the guide here to setup LLDB for running node_api addons and was able to isolate the error as originating from line 738 in 'labels.cc.' The unordered list being created here triggers an error when it tries to run the constructor for the list items. I tried commenting out the initialization items and that got past the error:
I am not sure exactly what is wrong here. I will keep investigating to see if I can get to the bottom of these initializers and why they are failing but if something jumps out at you lmk!
Here is my
npm version
info: