So I have a big folder called Geometry and I divided in CPP folder and Cython folder as follows.
- Geometry
- CPP (Where all the cpp codes are)
- Cython
- src folder
- Geometry Package
- Point Package
- __init__.py
- libcustom.so
- Circle Package
- __init__.py
- libcustom.so
- __init__.py (Ignore this file)
- libcustom.so
- test folder
- setup.py
In Point.__init__.py
and Circle.__init__.py
, I have to add the following
import ctypes
import os
libcustom = ctypes.CDLL(os.path.join(os.path.dirname(__file__), "libElements.so"))
Now as you can see, in order for my libcustom to work on all packages including Point and Circle, I have to add the libcustom.so in both Point and Circle, which doesn’t look so good.
Now I want to remove all libcustom.so from Point and Circle and only keep the one outside.
- Geometry
- CPP (Where all the cpp codes are)
- Cython
- src folder
- Geometry Package
- Point Package
- __init__.py
- Circle Package
- __init__.py
- libcustom.so
- __init__.py (Ignore this file)
- test folder
- setup.py
How should I change my Point.__init__.py
and Circle.__init__.py
code so that it will point a reference to the libcustom.so
outside?