-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need help with creating node.js binding for tvision #27
Comments
Hi unxed. The build process is clearly missing include directories. Take a look at this issue: charto/nbind#35. They seem to solve it by providing compilation flags in environment variables or in the So, for the error above, you would need something like My first impression anyway is that porting Turbo Vision this way is going to be painful, because of differences between C++ and JavaScript. JavaScript is a highly dynamic language with extremely useful features such as asynchronism. So, for instance, it does not make sense to sleep the process while waiting for user input, which Turbo Vision in C++ does. Strings in JavaScript are UTF-16 while Turbo Vision expects UTF-8, JavaScript has garbage collection instead of RAII, etc. Therefore I think it would be best to port most of Turbo Vision to native JavaScript, instead of having to keep working around the differences between both languages. But I'm just being pessimistic, thanks for trying and let's see how your attempt goes :) |
Thanks for your advice, it helped me to move further. I'll leave here my
Added "-I"s and changed c++ version from 11 to 17. |
It's a C++11 error. Try to set EDIT: Oh but, you already tried. Although I can still see C++11 in one of the configuration variables. Does changing that one solve the issue? |
Thanks, already guessed. It helps!
|
xcode block is for MacOS AFAIK, and I'm building from Linux Mint |
TApplication is expected to be inherited instead of being used directly, so its constructors are protected. You will have to create a subclass of TApplication class with public constructors. You can see an example of this in the hello.cpp program. |
Now excuse me, I have to go and I won't be able to answer you immediately. Good luck! |
The last recommendation helped, it finally builds, thanks! Still fails to run with
Possibly I should ask nbind guys about this? |
My guess is that the issue is Turbo Vision being a static library, so the compiler optimizes out unused symbols. Try replacing STATIC with SHARED in CMakeLists.txt, link the module against libtvision.so and add the path containing libtvision.so to LD_LIBRARY_PATH so that the dynamic linker can find it. |
nbind builds it's own custom version of libtvision.so with it's own additional routines included. I guess if I give it .so build by myself without all that stuff it is hardly to work correctly. |
Could it be that the libtvision.so generated by nbind only contains the code of your entry .cpp file and has not been linked against libtvision.a? |
Sorry to deceive you, its js_tvision.o that nbind creates, not libtvision.o. It looks like, in addition to specifying the headers path, it is necessary to somehow explain to nbind how to build the turbo vision itself. AFAIK, node modules should be built using just the same compiler flags as node, so its enough just to provide node with my own libtvision.so. |
nbind cannot be asked to build Turbo Vision, because it doesn't know how to. Only CMake knows how to build Turbo Vision. When compiling from the command line, libtvision.a is linked in just by placing it in the arguments list next to the source code files:
So maybe for nbind you only have to list it as another source file. |
Hello. Any progress in this issue? |
Hola Tomás, There's probably not been much progress, given that unxed did not even get an aswer to charto/nbind#139. I do not have high expectations about it, though. Considering that the Turbo Vision API requires the programmer to use inheritance, I suspect a port based on native bindings won't be very usable, or at least it will be harder to get working than just writing the library directly in JavaScript. Additionally, JavaScript has first-class functions and coroutines, asynchronous I/O, prototype-based inheritance... It would be very hard for native bindings to take advantage of any of these. Saludos. |
Hello! I've just experimenting with node.js binding for tvision. This tool has the possibility to simplify such work:
https://github.com/charto/nbind
I followed this tutorial (replacing vg with tvision):
https://github.com/charto/nbind/blob/master/doc/vg-tutorial.md
Made simple demo js_tvision.cpp:
Unfortunately,
npm run -- node-gyp configure build
step fails with the following error:Please suggest the direction of further work! Thanks!
PS: There is a huge demand in the world of node.js for a powerful TUI framework. Take a look at this module and the number of its forks:
https://www.npmjs.com/package/blessed
https://www.npmjs.com/package/neo-blessed
https://www.npmjs.com/package/post-blessed
But its capabilities are far from those of Turbo Vision, and its usability is far from perfect. My dream is to be able to do "npm install tvision", and use all TV power to create TUI interfaces for cli node.js applications.
The text was updated successfully, but these errors were encountered: