pythonnet / pythonnet/clr-loader

netfx loader with LOAD_LIBRARY_SEARCH_USER_DIRS

Đang mở
#77 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
42
Fork
32
Merge trung bình
14 giờ 1 phút
Pull request đã merge (30 ngày)
1

Mô tả

If the win32 API SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS) is used, the default clr_loader doesn't work.

import ctypes
from ctypes import wintypes

dll = ctypes.CDLL("Kernel32.dll")
dll.SetDefaultDllDirectories.argtypes=[wintypes.DWORD]
LOAD_LIBRARY_SEARCH_USER_DIRS = 0x00000400
dll.SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS)
import clr # <---- crash

This search mode is documented here

It is used in the python distribution from the windows store (although I don't know if this issue is reproducible there) as well as some embedders of Python.

I tried the following as a workaround:
import os
os.add_dll_directory(r"C:\Windows\Microsoft.NET\Framework64\v4.0.30319")
os.add_dll_directory(r"C:\path\to\python\env\site-packages\clr_loader\ffi\dlls\amd64")

And it didn't work.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện đoạn mã Python gọi SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS) trước khi import clr. Kiểm tra đường dẫn tải DLL của clr_loader và thư mục ffi/dlls/amd64 của nó, sau đó xác minh rằng việc import clr hoạt động trong chế độ tìm kiếm Windows này mà không phụ thuộc vào workaround đã được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
devtools, operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.