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

Q&A's, tips, howto's
Locked
iNPRwANG
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

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

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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

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

Post 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)

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

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

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

iNPRwANG
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

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

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

iNPRwANG
Posts: 32
Joined: Sun May 08, 2011 1:45 pm

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

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

Locked