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

Started by iNPRwANG, May 21, 2013, 07:16:04 PM

Previous topic - Next topic

iNPRwANG

OS is windows xp sp3, these code works better on newLisp 10.4.5:



(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?

Lutz

#1
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:



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

Lutz

#2
... and you also should try:

(import "msvcrt.dll" "sscanf" "cdecl") ; <- C-calling conventions for varargs


C-calling conventions may handle variable number of arguments in sscanf better.

iNPRwANG

#3
I had met some problem with my compiled newLisp,such as http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4099">//http://newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4099 and this problem.



Now I packed my compiler, libs and uploaded it:



http://211.95.60.98:9090/">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.

iNPRwANG

#4
Quote from: "Lutz"... and you also should try:

(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.