1.1 KiB
1.1 KiB
tags, aliases, date, time, description
| tags | aliases | date | time | description |
|---|---|---|---|---|
| 2025-03-12 | 19:58:20 |
docstring
Add docstring in English to each classes and functions.
swig 教學文
閱讀 https://www.swig.org/ 這個網站,寫一篇教學文,教導如何使用 swig 這個工具來將 C++ library 包裝成 Python library。 教學要從簡單到進階,每一階段都要給出範例與解說。
範例建立一個 C++ 的 class,分3階段將這個class複雜化,並用 swig 建立 Python library。 作業系統: Windows 11 編譯環境: Visual Studio 2022 Python 版本: 3.12
Create global mutex
Use ctypes and Win32Api CreateMutex to create a global mutex here. Use class to wrap it.
This mutex shoid has these features:
- When user instantiate this class, use Win32api
OpenMutexto try to open this global mutex, because this mutex mybe alreday created in another process. - if
OpenMutexfailed, useCreateMutexto create the global mutex. - this class should provide lock and unlock function, use
WaitForSingleObjectandReleaseMutexto implement it. - And, very important, class should has
releasefunction of mutex.