Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.01 KB

this_and_sizeof.rst

File metadata and controls

43 lines (30 loc) · 1.01 KB

this & sizeof

The purpose

:doc:`Py++ <../index>` can expose a class sizeof and this pointer value to Python. I created this functionality without special purpose in mind.

Example

mb = module_builder_t( ... )
cls = mb.class_( <<<your class>>> )
cls.expose_this = True
cls.expose_sizeof = True

The Python class will contain two properties this and sizeof. The usage is pretty simple:

import ctypes
from <<<your module>>> import <<<your class>>> as data_t

d = data_t()
print d.this
print d.sizeof

Warning: I hope you know what you are doing, otherwise don't blame me :-)