I've reproduced the issue on separated Ubuntu 19.04 environment using 
latest available components:
emscripten-1.38.31
clang-e1.38.31-64bit
node-12.9.1-64bit

Is it a bug or my workflow is wrong?


W dniu czwartek, 5 września 2019 14:32:54 UTC+2 użytkownik Pawel napisał:
>
> Hi Thomas,
>
> I reproduce it using version 1.36.14.
> I cannot use newer versions (>=1.37.0) yet due to required dependencies 
> I'm obligated not to use in my project.
>
> W dniu środa, 4 września 2019 17:53:12 UTC+2 użytkownik Thomas Lively 
> napisał:
>>
>> Hi Pawel,
>>
>> I notice that the emscripten version you’re using is quite old. Can you 
>> reproduce the issue with the latest version?
>>
>> On Sep 4, 2019, at 06:38, Pawel <[email protected]> wrote:
>>
>> Hello All,
>>
>> I get a TypeError: Module.ClassA is not a constructor error while 
>> creating object.
>> I'm having a simple header class defined in header class_a.h:
>>
>> namespace MyNamespace
>>
>> {
>>
>>   class ClassA
>>
>>   {
>>
>>   public:
>>
>>     ClassA();
>>
>>     void PrintName();
>>
>>   };
>>
>> }
>>
>>
>> and its implemetation in class_a.cpp
>>
>> #include <iostream>
>>
>> #include "class_a.h"
>>
>> namespace MyNamespace
>>
>> {
>>
>>   ClassA::ClassA()
>>
>>   {
>>
>>     std::cout << "MyNamespace::ClassA constructor" << std::endl;
>>
>>   }
>>
>>   void ClassA::PrintName()
>>
>>   {
>>
>>     std::cout << "MyNamespace::ClassA::PrintName method" << std::endl;
>>
>>   }
>>
>> }
>>
>>
>> I described in interface in class_a.idl:
>>
>> [Prefix="MyNamespace::"]
>>
>> interface ClassA
>>
>> {
>>
>>   void ClassA();
>>
>>   void PrintName();
>>
>> };
>>
>>
>> Next I create glue files with:
>>
>> python ${EMSCRIPTEN_ROOT}/tools/webidl_binder.py class_a.idl class_a_glue
>>
>>
>> And glue_wrapper.cpp containing
>>
>> #include "class_a.h"
>>
>> #include "class_a_glue.cpp"
>>
>>
>> Now I'd like to create bitcode
>>
>> em++ class_a.cpp glue_wrapper.cpp --post-js class_a_glue.js -o class_a.bc
>>
>> and finally the javascript
>>
>> em++ class_a.bc -o class_a.js
>>
>>
>> Up to now everything works fine, neither error nor warning reported.
>>
>> I define simle client.js script creating object and calling method:
>>
>> var obj = new Module.ClassA();
>>
>> obj.PrintName();
>>
>>
>> When I load both class_a.jd and client.js scripts in html I get
>>
>> client.js:1 Uncaught TypeError: Module.ClassA is not a constructor at 
>> client.js:1
>>
>>
>>
>> The interesting is that, if I create javascript in one step (without 
>> intermediate .bc) then it works fine - I see proper printouts in browser 
>> console.
>> I'm however not likely going this way because I've got a bunch of classes 
>> I'd like to put into one javascript, e.g.
>>
>> em++ class_a.cpp glue_wrapper.cpp --post-js class_a_glue.js -o class_a.bc
>> em++ class_b.cpp b_glue_wrapper.cpp --post-js class_b_glue.js -o 
>> class_b.bc
>> em++ class_c.cpp c_glue_wrapper.cpp --post-js class_c_glue.js -o 
>> class_c.bc
>> ...
>> em++ class_a.bc class_b.bc class_c.bc ... -o class_a.js.
>>
>> I'm using:
>> emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 
>> 1.35.23
>> clang version 3.9.0  (emscripten 1.35.23 : 1.35.23)
>>
>> Why it does not work with intermediate bitcode step? Or maybe my approach 
>> is incorrect?
>>
>> Best regards, Paweł
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/fba850f3-944d-4626-a28b-bf1d376b76aa%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/emscripten-discuss/fba850f3-944d-4626-a28b-bf1d376b76aa%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/a92f8cb6-ddc3-4c8f-90ae-5f2d44e7aa58%40googlegroups.com.

Reply via email to