From 3f7b943b34605757256bf3308f97e31a47e733c1 Mon Sep 17 00:00:00 2001 From: Kartik Singh Date: Thu, 12 Dec 2024 20:47:03 -0800 Subject: [PATCH] os.add_dll_directory --- .github/workflows/windows.yml | 3 ++- examples/libcalc/example.py | 1 + examples/libcalc/exhaust_heap.py | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1c0db715..7c917cb0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -80,7 +80,8 @@ jobs: MSYS_PATH_TYPE: inherit shell: pwsh run: | - $env:PATH="$env:PATH;$env:LIBSBCL_PATH;D:\a\_temp\msys64\mingw64\bin" + $env:MINGW64_PATH="D:\a\_temp\msys64\mingw64\bin" + $env:PATH="$env:PATH;$env:LIBSBCL_PATH;$env:MINGW64_PATH" D:\a\_temp\setup-msys2\msys2.CMD -c '$SBCL_SRC/run-sbcl.sh --load script.lisp --quit' pushd libcalc mkdir build diff --git a/examples/libcalc/example.py b/examples/libcalc/example.py index fd618180..eb0f08ff 100644 --- a/examples/libcalc/example.py +++ b/examples/libcalc/example.py @@ -3,6 +3,7 @@ if platform.system() == 'Windows': os.add_dll_directory(os.environ.get('LIBSBCL_PATH')) + os.add_dll_directory(os.environ.get('MINGW64_PATH')) from ctypes import * import calc as libcalc diff --git a/examples/libcalc/exhaust_heap.py b/examples/libcalc/exhaust_heap.py index ba3191e1..cec0d947 100644 --- a/examples/libcalc/exhaust_heap.py +++ b/examples/libcalc/exhaust_heap.py @@ -1,7 +1,9 @@ -from ctypes import * -from ctypes.util import find_library +import os +import platform -print(find_library("sbcl_librarian")) +if platform.system() == 'Windows': + os.add_dll_directory(os.environ.get('LIBSBCL_PATH')) + os.add_dll_directory(os.environ.get('MINGW64_PATH')) import sbcl_librarian.wrapper import calc as libcalc