2

I intend to use Squirrel as a scripting language for my C++ application. Naturally, there should be an API for interfacing with the C++ code (for things such as accessing and modifying attributes in my C++ program). This API would consist of a bunch of classes, enums and functions.

While there are utilities like Sqrat that make binding single C++ functions to a Squirrel VM the matter of a single line of code, that is still not satifactory: It would require me to create both the C++ classes with their functions to actually do all the interfacing work, and then I'd have to maintain all the bindings to make those C++ functions known in my scripts as well. My intention is to remove this double maintenance overhead.

So what I want is a tool that would simply take the already existing header file containing all my C++ classes and functions and generate API registration calls from this file. And while we are at it, of course it would be nice to automatically generate a documentation for every function as well (doesn't matter if it's HTML or just a Squirrel script that contains of function definitions + comments or whatever).

I know there's SWIG, but it doesn't have a binding Squirrel, and that's not exactly what I would be looking for anyway - after all, I need to create C++ wraper code, not Squirrel code. I've seen Flex, but I'm not sure whether that's what I'm looking for, either. So is there any tool that would do what I want (automate the creation of wrapper code and API documentation from a C/C++ header)? Otherwise, I guess I might have to write my own little C++ parser that can parse simple function and class definitions.

rici
  • 234,347
  • 28
  • 237
  • 341
j_schultz
  • 649
  • 13
  • 29
  • I thought SWIG did generate C/C++ wrapper code for the target scripting language. What about switching over to lua since that is supported by SWIG. – greatwolf Aug 12 '13 at 01:14
  • The only times I have worked with SWIG was when I wanted to translate C library headers to another language. I wouldn't be surprised if it could do much more, but I'm not sure why. I've previously considered using lua but I don't like the language very much, so I'd like to stick to Squirrel, which is similar to lua, but much more like C/C++ in its nature. – j_schultz Aug 12 '13 at 11:22
  • j_schultz, have you found a solution ? – Alex Brooks Apr 28 '14 at 16:40
  • Sadly not. I haven't really worked on this project since I've posted this. So I'm still looking for an easy-to-use solution for the problem described above. – j_schultz Apr 28 '14 at 20:45

0 Answers0