Hi,
I'm having a problem with a library call.
I'm still trying to get newLisp to use IUP(1), and now I have to call a function with a variable number of arguments, which expects NULL as the last.
And whenever I call the function, newLisp crashes.
(context 'iup)
(set 'iup-imports '(
(iup.dll IupOpen IupDestroy IupClose IupSetHandle)
(iup.dll IupSetLanguage IupGetLanguage)
(iup.dll IupImage IupLabel IupDialog IupShowXY IupShow IupVbox IupHbox )
;;;; CONTROLS
(iup.dll IupButton IupMultiLine)
;;;; EVENT Handling
(iup.dll IupMainLoop IupLoopStep IupFlush IupGetCallback IupSetCallback
IupGetActionName IupGetFunction IupSetFunction
)
;;;; ATTRIBUTE handling
(iup.dll
IupStoreAttribute
IupSetAttribute IupSetAttributes IupSetfAttribute ;IupSetAttributeHandle
IupGetAttribute IupGetAttributes ;IupGetAttributeHandle
IupGetFloat IupGetInt
IupStoreGlobal IupSetGlobal IupGetGlobal
IupGetType IupHelp
)
(iup.dll
IupVbox IupVbox IupZbox IupFrame IupAppend)
;;;; pre-defined DIALOGS
(iup.dll IupGetFile IupMessage IupAlarm IupScanf IupListDialog IupGetText
)
;IupMessagef ???
)
)
(define (setup )
(dolist (dll-info iup-imports)
(set 'dll-name (first dll-info))
(dolist (func-name (rest dll-info))
(import (string dll-name) (string func-name))))
(set 'loaded true)
)
(define (test-box)
(IupOpen)
(IupSetLanguage "ENGLISH")
(set 'btn (IupButton "Test" nil))
(print 'define-hbox)
(set 'hb (IupHbox nil))
; --- the following line is never reached
; same with (set 'hb (IupHbox btn nil))
(print 'define-dlg)
(set 'dlg (IupDialog hb))
(print 'show-dlg)
(IupShow dlg)
(IupMainLoop)
(IupDestroy dlg)
(IupClose)
)
(setup)
(test-box)
(context 'MAIN)
Any idea what's happening here?
Thanks,
Ingo
(1) http://luaforge.net/projects/iup/
'nil' is not the same thing as NULL or the number 0 in the C language:
instead of:
(set 'btn (IupButton "Test" nil))
(set 'hb (IupHbox nil))
try:
(set 'btn (IupButton "Test" 0))
(set 'hb (IupHbox 0))
Lutz
Thanks Lutz,
I started to assume something like this, and seems you were right. My first test worked!
Kind regards,
Ingo