codeboost / bea

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

static class methods #4

Closed colormotor closed 12 years ago

colormotor commented 12 years ago

Would be nice to automatically handle static methods on classes :) It seems that right now I have to declare @static methods with a different class name, otherwise the C++ compiler complains...

codeboost commented 12 years ago

It does handle static functions. Just declare the function as static in the bea file:

static std::string className()

I think the confusion comes from the use of '@static' keyword in the class declaration. '@static' means static class, or better, static object, which cannot be instantiated by Javascript, but you can call it's methods from JS. That would be some global object in your C++ code or plain C functions.