Skip to content

add windows support#9

Closed
xinye0123 wants to merge 1 commit into
MooreThreads:mainfrom
xinye0123:supportwin
Closed

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

Conversation

@xinye0123

Copy link
Copy Markdown

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

@yeahdongcn

Copy link
Copy Markdown
Collaborator

@gingerXue Please take a look first. Thanks!

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

Copy link
Copy Markdown

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.

Comment thread pymtml.py
# Platform-specific library loading
platform = sys.platform

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

Copy link
Copy Markdown

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"

Comment thread pymtml.py
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")):

Copy link
Copy Markdown

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"

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

Copy link
Copy Markdown

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

Comment thread test_win.py
@@ -0,0 +1,32 @@
from pymtml import *

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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

@xinye0123

Copy link
Copy Markdown
Author

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

@yeahdongcn

Copy link
Copy Markdown
Collaborator

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

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

@yeahdongcn

Copy link
Copy Markdown
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