Skip to content

Commit

Permalink
Load bundled GMP library on Windows if not present
Browse files Browse the repository at this point in the history
  • Loading branch information
oldk1331 committed Sep 23, 2023
1 parent ad800b3 commit 7e14b14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: |
rm ../build/target/x86_64-w64-mingw32/bin/fricas
mv ../build/target/x86_64-w64-mingw32 FriCAS-windows-x86_64
cp /mingw64/bin/libgmp-10.dll FriCAS-windows-x86_64/lib/
zip -r FriCAS-windows-x86_64-${{ github.sha }}.zip FriCAS-windows-x86_64
- name: Upload Windows binary
uses: actions/upload-artifact@v3
Expand Down
12 changes: 8 additions & 4 deletions src/lisp/num_gmp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -824,12 +824,16 @@
(symbol-function 'orig-isqrt))
(sb-ext:lock-package "COMMON-LISP")))

(defun load-gmp-lib ()
#-:WIN32 (ignore-errors (|quiet_load_alien| "libgmp.so") t)
#+:WIN32 (if (ignore-errors (|quiet_load_alien| "libgmp-10.dll") t)
t
(ignore-errors (|quiet_load_alien|
(BOOT::make-absolute-filename "/lib/libgmp-10.dll")) t))

(defun init-gmp(wrapper-lib)
(if (not *gmp-multiplication-initialized*)
(if (ignore-errors (|quiet_load_alien|
#-:WIN32 "libgmp.so"
#+:WIN32 "libgmp-10.dll"
) t)
(if (load-gmp-lib)
(if (ignore-errors
(|quiet_load_alien| wrapper-lib) t)
(progn
Expand Down

0 comments on commit 7e14b14

Please sign in to comment.