Skip to content

add windows support#9

Closed
xinye0123 wants to merge 1 commit intoMooreThreads:mainfrom
xinye0123:supportwin
Closed

add windows support#9
xinye0123 wants to merge 1 commit intoMooreThreads:mainfrom
xinye0123:supportwin

Conversation

@xinye0123
Copy link

added windows support #8 (mtml.dll has installed to win's/system32 fold)

@yeahdongcn
Copy link
Collaborator

@gingerXue Please take a look first. Thanks!

mtmlLib = CDLL("libmtml.so")
except OSError as ose:
_mtmlCheckReturn(MTML_ERROR_FUNCTION_NOT_FOUND)
# Platform-specific library loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that we need to split up the windows and linux loader logic. Maybe refactoring the loader into smaller, well-defined helper functions with clearer responsibilities.

# Platform-specific library loading
platform = sys.platform

if platform.startswith("win32") or platform.startswith("cygwin"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer using: os.name == "nt"

continue

# If all attempts failed, try with full path to mtml/mtml.dll
if mtmlLib is None and (platform.startswith("win32") or platform.startswith("cygwin")):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as os.name == "nt"

```bash
# 检查 libmtml.so 是否可用
# 检查 MTML 库是否可用
ldconfig -p | grep libmtml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows, there is no ldconfig mechanism like Linux, please add the checking command like: where mtml.dll

@@ -0,0 +1,32 @@
from pymtml import *

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe no need to add this test file. It is the same as test_pymtml.py

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xinye0123 You can run the tests under https://github.com/MooreThreads/mthreads-ml-py/tree/main/examples to verify that everything works properly on Windows.

@gingerXue
Copy link

@xinye0123 I refine the code and doc, Please take a look: https://github.com/gingerXue/mthreads-ml-py/tree/supportwin

@xinye0123
Copy link
Author

不好意思,我只是看到pypi上的包还不支持win才提的pr,git不怎么会用哈,还是要靠大家完善,加油哦

@yeahdongcn
Copy link
Collaborator

不好意思,我只是看到pypi上的包还不支持win才提的pr,git不怎么会用哈,还是要靠大家完善,加油哦

好的,没问题,那我们来做吧。谢谢!

@yeahdongcn
Copy link
Collaborator

#10

@yeahdongcn yeahdongcn closed this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants