cocos2d / bindings-generator Goto Github PK
View Code? Open in Web Editor NEWJSBindings generator for C++
JSBindings generator for C++
Hi,
when two overload member function has the same params nums, the "ifunction_overloaded.c" will judge the first style and break.
same as,
C++:
void Node:addChild(Node* child, int localZOrder, const std::string &name)
void Node:addChild(Node* child, int localZOrder, int tag)
lua:
paraentNode:addChild(subNode, 100, "subNodeName")
...
why don't you use gcc/g++?
Hello devs!
I'm trying to run genbindings.py, but unfortunately I'm seeing the error, mentioned in the subject.
I'm on Ubuntu 14.04, I followed the instructions and set everything up, I have all python stuff and I have Android NDK r9b, so theoretically it should work, but nope.
Full stack trace is this:
Traceback (most recent call last):
File "/home/stranger/Library/cocos2d-x-3.3/tools/bindings-generator/generator.py", line 1418, in
main()
File "/home/stranger/Library/cocos2d-x-3.3/tools/bindings-generator/generator.py", line 1414, in main
generator.generate_code()
File "/home/stranger/Library/cocos2d-x-3.3/tools/bindings-generator/generator.py", line 1087, in generate_code
self._parse_headers()
File "/home/stranger/Library/cocos2d-x-3.3/tools/bindings-generator/generator.py", line 1114, in _parse_headers
tu = self.index.parse(header, self.clang_args)
File "/home/stranger/Library/cocos2d-x-3.3/tools/bindings-generator/clang/cindex.py", line 2113, in parse
self)
File "/home/stranger/Library/cocos2d-x-3.3/tools/bindings-generator/clang/cindex.py", line 2225, in from_source
raise TranslationUnitLoadError("Error parsing translation unit.")
Please tell me, maybe I forgot to do something or I can somehow get more detailed info about this error?
我因为安装了qt创造器的minGw安装包,并且把minGw的bin目录加入了path,这样会导致"发现未声明的类型char16_t"等clang的编译错误。
The documentation explains how to generates jsbindings, but it does not tell the proper way to integrate it into a cocos2d-js project.
6 warnings plus 1 error occur when I try to use llvm3.3 generate the binding code, seems warning wont affect much ,but error makes the process stop, Here is the error:
severity = Error,
location = SourceLocation file '/path/to/android-ndk-r9c//platforms/android-14/arch-arm/usr/include/math.h', line 532, column 5
details = "conflicting types for '__builtin_isnan'"
class A:public cocos2d:"Ref
{
static void info(const char * pszFormat,...);
}
我在工程里跑的时候,貌似不支持偶。你们是否测试过呢?
simple_test_headers = -I%(cxxgeneratordir)s/test/simple_tes
might be
simple_test_headers = -I%(cxxgeneratordir)s/test/simple_test.h
plus can you guys add more specification about BG? Realy block a lot on this.
Is this generator generic enough to bring in other languages with not a ton of work? GC langs could follow JS and non-GC langs could setup more direct bindings.
Or would it be better to find a more suitable tool (clang/llvm) for another language like Swift by means of a fork/port, such as the goal for PureSwift (and cocos2d-iphone before it).
When binding function with callback as parameter
void some_fun(int a, std::function<void()> callback)
{
if(callback)
{
callback();
}
}
A bindings-generator will create code like this:
do {
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[1]));
auto lambda = [=]() -> void {
...
};
arg1 = lambda;
} while(0)
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_some_fun : Error processing arguments");
gaf::GAFAsset* ret = some_fun(arg0, arg1);
And when you call this function from js:
js_cocos2dx_some_fun(10, null);
a non-null lambda argument will be passed to the called function some_fun(10, <lambda>);
In some cases this will lead to crash.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.