File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1313 This API is experimental and subject to change without notice.
1414"""
1515
16+ import logging
17+ import os
18+ import sys
1619import warnings as _warnings
1720
1821import executorch .exir ._warnings as _exir_warnings
2831# dependencies.
2932import torch as _torch
3033
34+ logger = logging .getLogger (__name__ )
35+
36+ # Update the DLL search path on Windows. This is the recommended way to handle native
37+ # extensions.
38+ if sys .platform == "win32" :
39+ try :
40+ # The extension DLL should be in the same directory as this file.
41+ pybindings_dir = os .path .dirname (os .path .abspath (__file__ ))
42+ os .add_dll_directory (pybindings_dir )
43+ except Exception as e :
44+ logger .error (
45+ "Failed to add the pybinding extension DLL to the search path. The extension may not work." ,
46+ e ,
47+ )
48+
3149# Let users import everything from the C++ _portable_lib extension as if this
3250# python file defined them. Although we could import these dynamically, it
3351# wouldn't preserve the static type annotations.
You can’t perform that action at this time.
0 commit comments