Page 1 of 1

Int type FFI problem between newLisp10.4.5 and newLisp10.5.0

Posted: Wed May 22, 2013 2:16 am
by iNPRwANG
OS is windows xp sp3, these code works better on newLisp 10.4.5:

Code: Select all

(import "msvcrt.dll" "sscanf")
	
(let ((day 0) (mon 0) (year 0))
	(sscanf "1990-01-01" "%d-%d-%d" (address year) (address mon) (address day)))
But crashed on newLisp 10.5.0, is any changes of the int datatype address?

Re: Int type FFI problem between newLisp10.4.5 and newLisp10

Posted: Wed May 22, 2013 2:57 am
by Lutz
Cannot reproduce, works fine here on 10.4.5, 10.4.6, 10.4.7, 10.4.8 and 10.5.0. There have been no changes between 10.4.5 and 10.5.0 related to this in the simple import interface or address function.

You could use this:

Code: Select all

> (map (fn (x) (int x 0 10)) (parse "1990-01-01" "-"))
(1990 1 1)

Re: Int type FFI problem between newLisp10.4.5 and newLisp10

Posted: Wed May 22, 2013 5:42 am
by Lutz
... and you also should try:

Code: Select all

(import "msvcrt.dll" "sscanf" "cdecl") ; <- C-calling conventions for varargs
C-calling conventions may handle variable number of arguments in sscanf better.

Re: Int type FFI problem between newLisp10.4.5 and newLisp10

Posted: Wed May 22, 2013 5:48 am
by iNPRwANG
I had met some problem with my compiled newLisp,such as http://newlispfanclub.alh.net/forum/vie ... =16&t=4099 and this problem.

Now I packed my compiler, libs and uploaded it:

http://211.95.60.98:9090/

Mingw.7z my used compiler
libffi-3.0.10.7z my libffi(no changed)
newlisp10.5.0.7z my compiled binary

newlisp version is 10.5.0, build with: makefile_mingw_utf8_ffi, the issue may reproduce.

Re: Int type FFI problem between newLisp10.4.5 and newLisp10

Posted: Wed May 22, 2013 5:50 am
by iNPRwANG
Lutz wrote:... and you also should try:

Code: Select all

(import "msvcrt.dll" "sscanf" "cdecl") ; <- C-calling conventions for varargs
C-calling conventions may handle variable number of arguments in sscanf better.
Well, I had found the issue just now.