python - Is it possible to create __attribute__((__constructor__)) functions in Cython source? -


when writing cython implementation file (.pyx), possible define functions __attribute__((__constructor__)) or __attribute__((__destructor__)) of shared library cython create extension module?

it wouldn't make sense place these prototype declarations in header file unless defined them in c file , compiled such function implementations cimported... __constructor__-ness of function apply that compiled library, not 1 compiled cython.

note not referring __cinit__ or __dealloc__ extension types instead c-specific functions designed run upon library load or unload.

it not clear me if requirements of module built cpython api (e.g. py_initmodule) prevent module having other function built entry hook automatically invoked when library loaded (or unloaded destructor).


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -