[Bf-python] static or not functions

Willian Padovani Germano wgermano at ig.com.br
Thu Jan 8 04:21:06 CET 2004


----- Original Message -----
From: <dunk at dunkfordyce.co.uk>
To: <bf-python at blender.org>
Sent: Wednesday, January 07, 2004 5:18 PM
Subject: [Bf-python] static or not functions


> sometimes i must declare functions like this :
>
> PyObject *Render_ToggleRenderDisplay(PyObject *self);
>
> sometimes they must be
>
> static PyObject *Render_ToggleRenderDisplay(PyObject *self);
>
> or it complains about incorrect amount of arguments when the function
is run python.

It compiles and links, but gives errors only when such functions are
called in a script?  Curious, I haven't seen that.  But maybe if you add
'(PyCFunction)' to their slots in the methods table (look at Camera.h,
for example), this goes away.  Not absolutely sure right now, but I
guess this is necessary for METH_NOARGS functions like the one above.

'static' for functions mean they are internal to a file and can't be
called from another source file.  If they are declared in a header file,
it also means this header can't be included in any .c file but the one
where the function is defined.  You get linking errors if you violate
this.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list