This repo contains the samples to demonstrate the methods to interface native code with Python.
Please go through the PDF document in the docs folder to know more about how to interface/ integrate native code (C/C++) with Python.
-
Install VS2022 for developing C/C++ applications
You can download a community version by following this link
Ensure that you choose the workload "Desktop developmen with C++" while installing Visual Studio 2022. -
Install the latest version of Python interpreter 3.12.x using the link
Customize the installation path while installing and set the path to C:\Python312.
You may also choose the option to update path variable so that this interpreter will become your default interpreter. -
Open windows command prompt and set the path variable using the below command.
set path=C:\Python312;C:\Python312\Scripts;%path%
This step is needed only if you have not choosen the option to update path variable at the time of installation. -
Install the build package required for building the python wheel packages using the command below.
python –m pip install build -
Install the wheel package required for building the python wheel packages using the command below.
python –m pip install wheel -
Install the setuptools package required for building the python modules using the command below.
python –m pip install setuptools
-
You need GCC tool chain which comes as the default tool chain in most of the Linux based OSes.
-
Use the instructions in this link to install Python3.12.1 .
-
Install the build package required for building the python wheel packages using the command below.
python3 –m pip install build -
Install the wheel package required for building the python wheel packages using the command below.
python3 –m pip install wheel -
Install the setuptools package required for building the python modules using the command below.
python3 –m pip install setuptools
To build and install the samples in ctypes_samples go through the instructions provided in ctypes_sampes\Readme.txt
To build and install the samples in python_c_api_samples go through the instructions provided in python_c_api_samples\Readme.txt