I wanted to use al:show-native-message-box
which is equivalent of
(defcfun ("al_show_native_message_box" show-native-message-box) :int (display :pointer) (title :string) (heading :string) (text :string) (buttons :string) (flags messagebox-flags))
But when i wrote: (in-package #:al-tut) (defvar *created-display*) (defun main () (unless (al:init) (al:show-native-message-box (c:null-pointer) (c:null-pointer) (c:null-pointer) "allegro init failed." (c:null-pointer) (c:null-pointer)) 'AL-INIT-FAILED) (setf *created-display* (al:create-display 800 600)) (unless *created-display* (al:show-native-message-box (c:null-pointer) (c:null-pointer) (c:null-pointer) "window init failed. " (c:null-pointer) (c:null-pointer)) 'AL-CREATE-DISPLAY-FAILED) (c:with-foreign-string (text "MessageBox Title") (al:show-native-message-box *created-display* text (c:foreign-enum-value 'al::messagebox-flags :error) (c:foreign-enum-value 'al::filechooser-modes :show-hidden) (c:null-pointer) (c:null-pointer))) (al:destroy-display *created-display*))
where
(defcenum messagebox-flags (:warn 1) (:error 2) (:ok-cancel 4) (:yes-no 8) (:question 16))
in the source code.
But SBCL gives me the error:
2 is not a Lisp string or pointer. [Condition of type SIMPLE-ERROR]
Need help. Thanks
On Wed, 19 Jul 2023 at 12:41, oleg harput olegharput@gmail.com wrote:
2 is not a Lisp string or pointer. [Condition of type SIMPLE-ERROR]
al_show_native_message_box's 3rd argument should be a string but you're providing (c:foreign-enum-value 'al::messagebox-flags :error) which is a number.