Files
Obsidian-Main/20.01. Programming/Prompting.md
Awin Huang 5dc08ee680 vault backup: 2025-03-18 08:43:56
Affected files:
20.01. Programming/Prompting.md
2025-03-18 08:43:56 +08:00

30 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
tags:
aliases:
date: 2025-03-12
time: 19:58:20
description:
---
# 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:
1. When user instantiate this class, use Win32api `OpenMutex` to try to open this global mutex, because this mutex mybe alreday created in another process.
2. if `OpenMutex` failed, use `CreateMutex` to create the global mutex.
3. this class should provide lock and unlock function, use `WaitForSingleObject` and `ReleaseMutex` to implement it.
4. And, very important, class should has `release` function of mutex.
# 參考來源