[Qt-interest] Scripting support for Qt/C++ application

Bo Thorsen bo at fioniasoftware.dk
Tue Nov 1 08:17:01 CET 2011


Den 01-11-2011 06:10, Jonathan Greig skrev:
> Bo, do you have any suggestions on an easy way to call python that isn't
> an inc/dec ref nightmare? Right now I'm using boost python for exposing
> native functions, and calling expressions to run my python scripts. I
> agree that Its somewhat on par with QtScript on light scripting but
> bombs when heavier scripting is used.

The proper way is to do code generation for it. When I use Python or 
some other language, I'd create a code generator that takes something 
like this:

function foo(int bar)

and generates all the code for setting up this stuff. That way, you 
don't have to handle the ref crap yourself.

I'm very much a proponent of code generation for this kind of stuff, and 
writing a small compiler that takes specialized input and throws out C++ 
code is pretty easy.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list