ftk / quickjspp

QuickJS C++ wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling on windows : Error

benkuper opened this issue · comments

Hello,
I'm trying to compile quickJS with VS2019 and the I narrowed down the errors to only one type, related to this templated function

template <typename R, typename... Args, R (* F)(Args...), bool PassThis>
struct js_traits<fwrapper<F, PassThis>>

template <typename R, class T, typename... Args, R (T::*F)(Args...)>
struct js_traits<fwrapper<F>>

template <typename R, class T, typename... Args, R (T::*F)(Args...) const>
struct js_traits<fwrapper<F>>

The error I get is

E0842 template parameter "R" is not used in or cannot be deduced from the template argument list of class template "qjs::js_traits<qjs::fwrapper<F, false>>"

When I comment out those 3 functions, it actually compiles (I couldn't test because I have yet to compile the static quickjs.lib file

So I have 2 questions :

  • Do you have an idea on how to make it working with MSVC ?
  • Are those functions critical to use QuickJSPP or are they just helpers ? (I'm actually just getting started on QuickJS, we're building a JUCE module)

Thank you !

commented

Seems to be compiling fine for me:
image
Those functions are used to wrap C++ functions (.function<&myfunction>())
Also, quickjs already works fine with MinGW on Windows

Thanks for the fast reply, this is what I get though, with the same command line.
Screenshot_1

Also, my goal is to export a static library out of it so I can use it as a JUCE Module.
Would it be possible if not too complicated for you to put an x64 static .lib (and / or dynamic with .dll) in the release section of the repo ? It would sure help a lot of people trying to use this super lib and not having the whole toolchain for it.
I actually could export a static library from MinGW of quickJS but then a lot of dependencies due to the compilation through gcc made it overcomplicated and not worth it. I'm sure there is a simple solution to that but we've spend the whole day trying to figure out how to make the code compatible through Visual Studio 2019 and didn't get a lot of good results..

Also, what option are you using in CMake to generate the project ? Because I had to change example.cpp to include "../quickjspp.hpp" for it to actually find it, and the file structure you have in your screenshot is not the one in the repo.

Visual Studio 2019 and didn't get a lot of good results

QuickJs not compatible with MSVC. It uses GCC specific (attribute etc.) features.

commented

I've built 32-bit quickjs dll with mingw: https://github.com/ftk/quickjspp/releases/tag/v20191027
I don't think 64-bit mingw dlls can be used with msvc

too bad, so no possibility of using it with an MSVC 64-bit project then ?

commented

Oof. The problem was that MSVC doesn't define x86_64, so JSValue was nan-boxed by quickjs. Added 64bit dll, seems to work with patched quickjs.h on MSVC.

Nice !! thank you very much, I'll tell you when I'll get back to this development, but it's definitely good news !