Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Gaurav
    @imgauravdewan_twitter
    Is there any quick way or C++ trick to remove the exceptions from the code ? I can #define try to nothing. But what to do with (1)catch(int& x) catch(...) (2)throw; void f() throw() ?? Is there any non-intrusive (and non-destructive) way (other than removing throw catch from the code)?
    Alessandro Pignotti
    @alexp-sssup
    Hello @imgauravdewan_twitter , indeed Cheerp does not support exceptions currently, mainly due to the high overhead that JS engines introduce when using JS try{}catch constructs. There is also no way to automatically drop exception blocks. My suggestion would be to go over the codebase and use #ifndef CHEERP syntax to ifdef out the catch blocks and the try keyword.
    gitter has eaten my keywords, #ifndef __CHEERP__
    Gaurav
    @imgauravdewan_twitter
    I found a way
    1) try – #define try / nothing /
    2) catch(…) catch(int& x) etc – Use variadic macro #define catch(…) if(true)
    a. alternative: grep the source code and replace it with if(false) or while(false) and ignore compiler warning
    3) throw obj; - #define throw /nothing /
    4) void f() throw(int) – Although #define throw(…) /nothing/ works but it conflicts with clause 3 above – so manually changing the code for this construct under macro #if EXCEPTION_ENABLED recommended.
    Alessandro Pignotti
    @alexp-sssup
    I think catch should be defined to if (false) if you want to ignore exceptions
    Gaurav
    @imgauravdewan_twitter
    yea corrected
    Alessandro Pignotti
    @alexp-sssup
    to keep the codebase compatible with regular compiler I would suggest adding all the defines under an #ifdef __CHEERP__
    Gaurav
    @imgauravdewan_twitter
    yes sure
    I will start porting next week - now i am clear on most concepts of cheerp
    I tested STL, variadic templates etc and sample programs - seem to be working fine
    Is there any gotcha I need to be careful of (not documented in wiki) ?
    Thanks
    Alessandro Pignotti
    @alexp-sssup
    Keep in mind that type unsafe casting of pointers is not supported, most type safe C++ code works like a charm though.
    What is the project about?
    If you can share this information
    Gaurav
    @imgauravdewan_twitter
    This is company internal project at the moment and we are investigating optimum C++ to JS conversion workflow. We have been able to test asm.js and wasm and now want to evaluate this different approach.
    Karl zwinnen
    @karl_zwinnen_twitter
    Nice work! I'm definitely going to expiriment with this!
    One thing puzzles me though.. it states that 64 bit integers are supported natively (http://blog.leaningtech.com/2016/02/cheerp-12-c-to-javascript-with-faster.html), but Javascript doesn't natively support 64 bit integers (like mentions here: https://github.com/leaningtech/cheerp-meta/wiki/64-bit-integer-support)?
    Alessandro Pignotti
    @alexp-sssup
    @karl_zwinnen_twitter 64bit integers in clang are compiled to multiple 32bit operations. Since the code is generated so early in the compilation process the code can then be optimized by LLVM to reduce the overhead of such non-native implementation
    Plaristote
    @Plaristote
    Hi guys ! I've been experimenting with cheerp, and so far so good, I know this is still experimental, but I've found nearly anything I could possibly need ! Still, I'm wondering, is there already a way of making a javascript function from a lambda, apart from the EventListener ?
    Alessandro Pignotti
    @alexp-sssup
    The cheerp::Callback method generates an client::EventListener* pointer that is actually a JS function. What is the limitation you are encountering?
    Plaristote
    @Plaristote
    Indeed, I was wrong. I've been able to do what I wanted using cheerp::Callback. Thanks !
    Alessandro Pignotti
    @alexp-sssup
    Cool
    jiams
    @jiams
    can cheerp work with glup or webpack?
    Alessandro Pignotti
    @alexp-sssup
    @jiams Cheerp can generate a module with the -cheerp-make-module command line option. Since it's normal JS you can use any toolchain that you like, but we recommend that you don't minimize the output as Cheerp generates carefully optimized code and minimizer can actually make it worse. Cheerp generates minified code automatically unless you explicitly set the -cheerp-pretty-code option
    jezzarb94
    @jezzarb94
    hi
    how do i get access to the cheerpj program
    Alessandro Pignotti
    @alexp-sssup
    @jezzarb94 cheerpj is currently only available in beta for early adapters. If you want to apply to the early adapters program please drop us a line at info@leaningtech.com describing your project.
    Aleksander Guryanov
    @caiiiycuk
    Hi guys! Can somebody explain or provide link to docs, where I can found how to use cheerp with cmake? Thanks
    Aleksander Guryanov
    @caiiiycuk
    I trying to use /opt/cheerp/bin/cheerpwrap cmake .., but in this case make uses wrong compiler (/usr/bin/clang)
    Alessandro Pignotti
    @alexp-sssup
    @caiiiycuk you need to use the cmake toolchain file provided in Cheerp (/opt/cheerp/share/cmake/Modules/CheerpToolchain.cmake). -DCMAKE_TOOLCHAIN_FILE=/opt/cheerp/share/cmake/Modules/CheerpToolchain.cmake
    Kibeom Kim
    @kkimdev
    Hi, I have a license question. To my understanding Cheerp is released as GPL v2 but does it also affects the resulting wasm binary?
    JF Bastien
    @jfbastien
    @sderossi / @alexp-sssup Hi ! Congrats on the wasm launch :) I was wondering if you were interested in joining the CG? https://www.w3.org/community/webassembly/ We've mostly only had Emscripten representation for tooling, and it would be great to have types of producers.
    Alessandro Pignotti
    @alexp-sssup
    @jfbastien Thanks a lot for your interest, we really appreciate it. One of our engineers (Sander van Veen) has already joined a few meetings but I think he has not been authorised yet to join the WebAssembly community group. I'll join myself as well. Looking forward to collaborate!
    Stefano De Rossi
    @sderossi

    @kkimdev it does, see https://github.com/leaningtech/cheerp-meta/wiki/FAQs-(Frequently-asked-questions)#should-i-release-my-code-as-gpl-if-i-use-cheerp.

    However, if GPLv2 restrictions are not acceptable, we offer alternative (non-copyleft) licenses https://leaningtech.com/cheerp/

    JF Bastien
    @jfbastien
    @alexp-sssup great! Looking forward to working with all of you :smile:
    Zack Penn
    @hikilaka
    hey guys
    i have a question--i have a function that does a simple client::console.log call, i'm setting the cheerp::wasm attribute and whenever it gets executed, it prints 0 every time
    is there a reason why?
    Alessandro Pignotti
    @alexp-sssup
    Hello @hikilaka. The WebAssembly standard does not allow any DOM call. Not even a simple console.log. Cheerp can split the same C++ codebase into plain (optimized) JS and WebAssembly to workaround this limitation.
    All the DOM code (i.e. stuff in the client:: namespace) needs to be inside a function tagged with the [[cheerp::genericjs]] attribute
    In the specific case of console.log we provide a convenience wrapper already, it is called cheerp::console_log and it can be used from wasm code
    In the final Cheerp 2.0 release there will be proper frontend errors when trying to call DOM and JS methods from wasm code, unfortunately these are not available in RC1
    @hikilaka One more thing, if you are compiling with the -cheerp-mode=wasm command line option you don't need to also add [[cheerp::wasm]] to your code, as that will be the default.
    Zack Penn
    @hikilaka
    ahhh, right. thanks @alexp-sssup. Are you one of the developers of cheerp?
    it appears so. where can i submit a bug report? i'm actually having trouble with the -cheerp-mode=wasm option. it's crashing the compiler.
    well actually, idk, that may have to do with the wasm limitation you listed. i'll get back on that lol
    Alessandro Pignotti
    @alexp-sssup
    @hikilaka You can report bugs here: https://github.com/leaningtech/cheerp-meta/issues. Take a look at this for an extensive example on how to mix DOM APIs and wasm code: https://github.com/leaningtech/cheerp-meta/wiki/Cheerp-Tutorial:-Mixed-mode-C---to-WebAssembly-and-JavaScript
    OSM go
    @OSM__go_twitter
    After XMLHttpRequest: How can I pass the return of get_responseText() to a WASM function to work with it (as char*)
    Alessandro Pignotti
    @alexp-sssup
    @OSM__go_twitter WASM code can only access memory from the wasm heap. To pass memory to him you should actually allocate the memory on the wasm side, pass the pointer to it genericjs code (this is allowed) and then notify the wasm side to use the data. It is not possible to pass the pointer back to wasm as it is not possible to know that it's from wasm anymore.