codeboost / bea

Expose your C++ Libraries to Javascript with Google's V8
20 stars 4 forks source link

Why is nobody using this? #1

Closed flowerornament closed 12 years ago

flowerornament commented 12 years ago

This seems like a panacea, and JOpenFrameworks as well. Why have these projects not taken off? Is it a matter of lack of marketing, have they been superseded by other projects, are there downsides that are not immediately apparent? Being able to very easily use C++ from V8 seems like something that people would be all over, especially since, as I understand, the FFI is not very good.

codeboost commented 12 years ago

Good question. I guess it's a combination of lack of marketing and that it looks too 'magical' to be true :). I've used this technology to script 3 large C++ frameworks - OpenFrameworks, OpenCV and the partially, JUCE C++ GUI as well as for some smaller libraries. With a bit of tweaking it can also be used to expose C++ libraries to node.js.

colormotor commented 12 years ago

Hi, this looks amazing, but I can't figure out how to run the converter from the command line in osx. do I have to call bea through Jsc?

codeboost commented 12 years ago

Yeah, it's been gathering dust for some time. But since there is at least one person on this planet who's interested in it, I'll quickly clean it up and commit an update.

colormotor commented 12 years ago

very interested! ill try to spread the word if it works

On 13/giu/2012, at 19:12, Florinreply@reply.github.com wrote:

Yeah, it's been gathering dust for some time. But since there is at least one person on this planet who's interested in it, I'll quickly clean it up and commit an update.


Reply to this email directly or view it on GitHub: https://github.com/codeboost/bea/issues/1#issuecomment-6307140

codeboost commented 12 years ago

Ok, so I've pushed an update - cleaned up and added a demo project (examples/hello). There's README.md which describes the build steps (OSX and Linux for now). I've also updated the bea/README.md file which explains how to install and run it.

Good luck, let me know if it worked !

colormotor commented 12 years ago

Hey thanks alot! seems like it's working, still have to get it running in V8 but that will take a bit longer, will keep you posted

For the moment I had some little problems:

but I have the feeling this will save me lots of time!

colormotor commented 12 years ago

actually no problems with nested namespaces....

codeboost commented 12 years ago

Ok, thanks for the update. I've fixed the use of 'public' as a variable name - I had CoffeeScript 1.2 on my system and it seemed to work..

You shouldn't need to change the path. Go to your target directory (eg. were your project is) and call bea relatively, (take a look at examples/hello/bea.sh).

Not sure about the nested namespaces, did it work ?

colormotor commented 12 years ago

hey this is just great... in a couple of days I already have a repl and scripting in my engine. Getting nested namespaces to work takes a bit extra effort, because I have to often specify the namespace of classes, but it's not a big problem

codeboost commented 12 years ago

Getting nested namespaces to work takes a bit extra effort

Try using typedefs to shorten the names. Bea is a code generator, not a compiler, it doesn't really understand what a namespace is. So you can give it anything as long as the C++ compiler can figure it out. For instance:

namespace One{
    namespace Two{
        class MyClass{}...  
    }
}

You can typedef your objects-to-be-exposed in a separate namespace and feed that to bea:

namespace JS{
typedef One::Two::MyClass MyClass;  
}

Then, use the JS namespace in your .bea file. Bea will spit out the generated code and as long as the compiler can figure out the types, you should be ok.

Hope this helps. I'm going to close this issue now.