help - obtaining the type of the object using tp_name

Yaşar Arabacı yasar11732 at gmail.com
Sun Dec 25 07:53:55 EST 2011


And by the way, I would advice asking these kinds of questions in
#python-dev IRC channel (Freenode). I believe you can get much better help
about your problems regarding C-api there.

2011/12/25 Mrinalini Kulkarni <mrinalini at edss.co.in>

> Hello,
>
> I have embedded python into a vc++ app. I need to obtain type of the
> variable defined in the python script, in my c++ code.
>
> PyObject *pMyObject; -> assume points to a variable defined in the python
> script
>
> Now I want to do something like this
>
> const char * typeName;
>
> typeName = pMyObject->ob_type->tp_name
>
> Is this possible ? I tried doing this but it crashes.
>
> What is the alternative way for getting the name of the type from python.
> Is there a function available for this purpose such that I can obtain the
> address of that function using GetProcAddress and then use it for
> determining the type. (I am required to link to python dynamically)
>
> thanks,
> MK
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://yasar.serveblog.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111225/58afcc68/attachment-0001.html>


More information about the Python-list mailing list