Sunday, 18 August 2013

Overriding default SWIG name for static class functions

Overriding default SWIG name for static class functions

I have several classes that I am using swig to wrap for an embedded Lua
script. We have already defined what we want the function calls to look
like.
display.writeLine("Hello")
The problem is that SWIG doesn't seem to have an option to define how it
generates the library name. The c++ class looks like this.
class Display
{
public:
static void writeLine(char *);
}
I can easily get SWIG to wrap this function, it's just that always shows
up like this Display_writeLine()
So instead of just using my custom namespace, I would have to do
display.Display_writeLine()
which is not what I want. I have tried experimenting with the rename rules
but nothing seems to work. Right now I have an extern C function that then
calls my static function but it's an extra call I don't need. Seems like
it should be something simple...

No comments:

Post a Comment