[C++-sig] void* cast to a specific type based on string name

Roman Yakovenko roman.yakovenko at gmail.com
Sat Oct 4 20:06:44 CEST 2008


On Sat, Oct 4, 2008 at 12:38 AM, Renato Araujo <renatox at gmail.com> wrote:
> Hi thanks again, I found some e-mails about this, but my problem continue:
>
> now I reimplemented the function to some like that:
>
> void call_Pyfunction(int argc, char **types, void **args, PyObject *callbak)
> {
>    boost::python::list pyArgs;
>    for (int i=0; i <= count; i++)
>    {
>        pyArgs.append(args[i]);
>    }
>    callback(pyArgs);
> }
>
> but the error still happen:
> If i put the correct cast before "args[i]" this works fine;
>
> ..........
>    for (int i=0; i <= count; i++)
>    {
>        pyArgs.append(*(int *)args[i]);
>    }

I don't understand you. Why do you expect that boost::python::object
will guess the actual type from void*?


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list