binding generator


#1

I use cocos2d-x 3.0, I want to know whether “binding generator” works on win32 platform now.
how can I export a new function into lua now?

binding generator depends on llvm, but llvm now doesn’t work perfectly on win32. is that that the reason.

I just want to export CCNode::scheduleOnce(handler, interval) into lua.

thanks very much for any help.

h6cker.


#2

You can refer to the funtions exportde to lua by manual in lua_cocos2dx_manual.cpp file.


#3

Yep, bindings-generator is not supported on windows in cocos2d-x3.0.


#4

Issue http://www.cocos2d-x.org/issues/2869 was created. Thanks for your feedback.


#5

it is a little regretful. I want to know how you develop c2dx on win32 platform.
how can I generate “lua_cocos2dx_manual.cpp” on win32 platfrom.

@james chen
I found a bug and have fixed it on my own branch, can you help me review it.

CCSchedule.cpp line 232
if (0 != _scriptHandler)
{
Director::getInstance()->getScheduler()->unscheduleScriptEntry(_scriptEntryId);
}


#6

I’m quite new to cocos2dx, so if I’m wrong please correct me.

As I read in


and it says “spidermonkey is the only current target vm”.
I suppose it means the bindings-generator is only used for js?

Plus, I verified in 3.0alpha’s lua binding code(scripting\auto-generated\lua-bindings), it is still generated with tolua++.

So to answer the OP’s question, I think llvm is not related here.


#7

James Chen wrote:

Issue http://www.cocos2d-x.org/issues/2869 was created. Thanks for your feedback.


#8

thanks jianfei,

in 2.x version, I can modify pkgs to export functions into lua with tolua++.
but now I do not know how to finish this job in version 3.0 on win32 platform.

it is grateful for any help.


#9

Most of our team members are using MacOS, so it’s no problem to generate luabinding codes by bindings-generator.
For short-term solution: you could install a Mac or Linux vm for generating binding glue codes.
We will try our best to make it support win32 soon.


Error when running the genbindings.sh
#10

lua_cocos2dx_manual.cpp is not generated by bindings-generator,it contains funtions can’t bound to lua automatically.Now ,you can bind your function to lua by writing some code in the lua_cocos2dx_manual.cpp.About schedule,we don’t want to change the codes in the cocos2dx only for lua, do you have any better solution?


#11

hacker chen wrote:
>

in 2.x version, I can modify pkgs to export functions into lua with tolua**.
but now I do not know how to finish this job in version 3.0 on win32 platform.
>
it is grateful for any help.
Sorry that I didn’t digg deep enough before answering, and it seems that my only right thing is that I could make mistake here.
So in 3.0, the lua code is REALLY also generated by that generator.py, not tolua**. I’m not familiar with llvm neither, so I could not give any further help here. Maybe you could follow @James’ suggetion or wait till the issue get solved…