Skip to content

This repository contains the basic samples showcasing the methods to interface native code like c and c++ with Python

License

Notifications You must be signed in to change notification settings

jpshivakavi/nativecode_with_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

native-code-with-python-samples

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.

Pre-requisites to be installed for Windows OS:


  1. 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.

  2. 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.

  3. 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.

  4. Install the build package required for building the python wheel packages using the command below.
    python –m pip install build

  5. Install the wheel package required for building the python wheel packages using the command below.
    python –m pip install wheel

  6. Install the setuptools package required for building the python modules using the command below.
    python –m pip install setuptools

Pre-requisites to be installed for Linux OS:


  1. You need GCC tool chain which comes as the default tool chain in most of the Linux based OSes.

  2. Use the instructions in this link to install Python3.12.1 .

  3. Install the build package required for building the python wheel packages using the command below.
    python3 –m pip install build

  4. Install the wheel package required for building the python wheel packages using the command below.
    python3 –m pip install wheel

  5. Install the setuptools package required for building the python modules using the command below.
    python3 –m pip install setuptools

Building and Using the Samples:

ctypes_samples


To build and install the samples in ctypes_samples go through the instructions provided in ctypes_sampes\Readme.txt

python_c_api_samples


To build and install the samples in python_c_api_samples go through the instructions provided in python_c_api_samples\Readme.txt

About

This repository contains the basic samples showcasing the methods to interface native code like c and c++ with Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published