Skip to content

funcman/pylibdemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyLibDemo

License Tests Stars Forks

English | 中文

A Cursor-written project demonstrating how to call C libraries from Python. This project includes a simple C library that implements integer addition functionality and provides a Python interface.

Features

  • C library implementation of integer addition function
  • Python wrapper interface
  • Cross-platform support (Windows, Linux, macOS)
  • Using xmake as C library build tool

Requirements

  • Python 3.6+
  • xmake (for building C library)
  • C compiler (GCC, MSVC, or Clang)

Installation

pip install pylibdemo

Install from Source

  1. Clone the repository:
git clone https://github.com/funcman/pylibdemo.git
cd pylibdemo
  1. Install the package:
pip install .

Building C Library Separately

If you only want to build the C library:

cd src/clib
xmake

Usage Example

from pylibdemo import add_numbers, accumulate_n_times

# Using C library addition function
result = add_numbers(5, 3)  # returns 8

# Using Python wrapper accumulation function
sum_result = accumulate_n_times(2, 3)  # returns 6 (2+2+2)

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published