I have compiled with pretty-code and included relevant source.
(Open zip and go to binaries/WebsiteAlpha to see the juliar.js)

In a file src/core_module/math.cpp all I did was added was some std::map
variable.

Please keep in mind, using vectors works perfectly!

If I remove the std::map it works perfectly no javascript errors are
given and file executes to the finish. However, if I add an std::map to
any of functions in namespace it freaks out. g++/clang++ compilation
works well (no errors are given) However, when I compile a cheerp, it
gives me such error in javascript.

Please advice.

** Attachment added: "Second revision"
   
https://bugs.launchpad.net/cheerp/+bug/1644017/+attachment/4788260/+files/j.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

-- 
Mailing list: https://launchpad.net/~leaningtech-dev
Post to     : leaningtech-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~leaningtech-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to