File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
src/ansys/tools/installer Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -739,14 +739,38 @@ def _run_install_python(self, filename):
739739 self .setEnabled (True )
740740
741741
742+ def __restore_windows_dll_load ():
743+ """Restore DLL loading on Windows.
744+
745+ Notes
746+ -----
747+ PyInstaller on Windows may break DLL loading.
748+ This function restores the DLL loading on Windows.
749+ """
750+ import sys
751+
752+ LOG .debug (f"sys.platform: { sys .platform } " )
753+ if sys .platform == "win32" :
754+ LOG .debug ("Restoring DLL loading on Windows..." )
755+ import ctypes
756+
757+ ctypes .windll .kernel32 .SetDllDirectoryA (None )
758+
759+
742760def open_gui ():
743761 """Start the installer as a QT Application."""
744762 import argparse
745763 import ctypes
746764
765+ # Enable logging early
766+ enable_logging ()
767+
747768 if os .name == "nt" :
748769 import msvcrt
749770
771+ # Restore DLL loading on Windows...
772+ __restore_windows_dll_load ()
773+
750774 kernel32 = ctypes .windll .kernel32
751775
752776 # Parse command-line arguments
@@ -776,8 +800,6 @@ def open_gui():
776800 sys .stdout = open ("CONOUT$" , "w" )
777801 sys .stderr = open ("CONOUT$" , "w" )
778802
779- enable_logging ()
780-
781803 app = QtWidgets .QApplication (sys .argv )
782804 window = AnsysPythonInstaller ()
783805
You can’t perform that action at this time.
0 commit comments