← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1644017] Re: Using std::map in functions the second time crashes

 

I've attached the test case. The code attached works correctly in C++ (with modification of main and web). The code also compiles without any errors. However, when I run in the browser, I get the following error:
juliar.js:1 Uncaught ReferenceError: da is not defined(…)

This seem to happen at compilation step. Because if I compile it,
sometimes it gives this type of error. However, at times when I compile
with same script and same exact file no errors are generated.

(This seems to be a Cheerp error because it appears depending whether
the C++ file gets compiled correctly or not. Please advise)



The original code used for this test case can be found at: https://github.com/juliarLang/juliar/tree/master/binaries/WebsiteAlpha

Thanks,
Jay

** Attachment added: "WebsiteAlpha.zip"
   https://bugs.launchpad.net/cheerp/+bug/1644017/+attachment/4787749/+files/WebsiteAlpha.zip

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Cheerp.
https://bugs.launchpad.net/bugs/1644017

Title:
  Using std::map in functions the second time crashes

Status in Cheerp:
  New

Bug description:
  I am having a very large problem.

  I have a map which is identified with "std::map<string,string (*)(string,vector<string>)>".
  The map contains a name of the function that maps to the actual function.
  I have to make several calls to this map. The map is in global scope.

  One of my functions contains an std::map<string,string>. The map
  executes correctly if ran the first time, however, the second time it
  executes a function it errors out: "Uncaught TypeError: Cannot read
  property 'a0' of undefined" . I manage to find the cause of the
  problem and it seems to be including any type of std::map in a
  function. If I remove the std::map it executes fully and correctly. If
  I add it to any other function that is also has a pointer from
  "std::map<string,string (*)(string,vector<string>)>". it gives me an
  error on second execution. So for now, I am using vectors which seem
  to work. However, I would really love to use std::map<string,string>
  for several of my functions. Again, it executes once, but fails to
  execute second time. Perhaps this is due to Cheerp Preprocesser
  optimizing the std::map that executes first time and then after it
  completes the execution, the second time, it somehow tries to
  overwrite that object?

  I am not sure, but it would be great if it gets fixed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cheerp/+bug/1644017/+subscriptions


References